select city, count(city) from cities group by city -----Original Message----- From: Ken [mailto:[EMAIL PROTECTED] Sent: Friday, April 28, 2006 11:46 AM To: CF-Talk Subject: Re: Counting record repeats
Hi again. I tried the query you gave but all I am getting is this: City CityCount Los Angeles 1 Boston 1 New York 1 Los Angeles 1 New York 1 New York 1 Please help. What I need is this resultset: City CityCount Los Angeles 2 Boston 1 New York 3 Thanks, K On 4/28/06, Gert Franz <[EMAIL PROTECTED]> wrote: > 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:239054 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=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

