![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
|
Let us suppose we have this table ID - CITIES 1 New York 2 New York 3 Los Angeles 4 Los Angeles 5 Los Angeles 6 Atlanta 7 Atlanta 8 Atlanta 9 Atlanta How can I obtain the following ouput with a select query? Atlanta (4) Los Angeles (3) New York (2) |
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Let us suppose we have this table ID - CITIES 1 New York 2 New York 3 Los Angeles 4 Los Angeles 5 Los Angeles 6 Atlanta 7 Atlanta 8 Atlanta 9 Atlanta How can I obtain the following ouput with a select query? Atlanta (4) Los Angeles (3) New York (2) |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
On Sun, 30 Dec 2007 17:41:50 -0800 (PST), LaSalamandra wrote: Let us suppose we have this table ID - CITIES 1 New York 2 New York 3 Los Angeles 4 Los Angeles 5 Los Angeles 6 Atlanta 7 Atlanta 8 Atlanta 9 Atlanta How can I obtain the following ouput with a select query? Atlanta (4) Los Angeles (3) New York (2) SELECT YourTable.City Count(YourTable.City) AS CountOfCity FROM YourTable GROUP BY YourTable.City ORDER BY YourTable.City; -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
From a Microsoft article of many years ago: "Use Count(*) instead of Count([ColumnName]). Jet has built-in optimizations that make Count(*) much faster than column-based counts." As I understand it, at that time Jet counted in any available index for Count(*), but it scanned the table for Count([ColumnName]). Is this still pertinent for ACE, T-SQL and JET 4.0? I'm not sure, but my guess is "Yes". |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |