It's the same like in a thread somewhen before:
Select
City, Count(Id) As CityCount
From
Cities
Group By
City
Greetings / GrĂ¼sse
Gert Franz
Customer Care
[EMAIL PROTECTED]
www.railo.ch
Join our Mailing List / Treten Sie unserer Mailingliste bei:
deutsch: http://de.groups.yahoo.com/group/railo/
english: http://groups.yahoo.com/group/railo_talk/
Ken schrieb:
> I have a db table with records like this:
>
> ID City SomeCode
> 1 Los Angeles 52
> 2 Boston 46
> 3 New York 75
> 4 Los Angeles 45
> 5 New York 75
> 6 New York 55
>
> My Question is: Using a single SQL statement, is there a way to
> display the number of times each city occurs in the recordset?
> So, what I am looking for is this result:
>
> City CityCount
> Los Angeles 2
> Boston 1
> New York 3
>
> My database is MS SQL Server 2000.
>
> Please help me with a SQL Statement.
>
> Thanks,
> K
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:239043
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54