Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL statement ... count()

Status
Not open for further replies.

ighidan

Programmer
May 20, 2002
6
0
0
AE
hello guys,
i have a db table called "vehicle", the table contains a field called "model". i wanna retrieve the count() for each model by one query. i want my query to output: count(Q45), count(X40), count(BMW2000), etc ....
How can i do this?

Thanks. <CFQuote>THE JOURNEY OF A 1000 MILES BEGINS WITH 1 STEP</CFQuote>
 
Thank you guys, I found the solution:

<cfquery datasource=&quot;#application.dsn#&quot; name=&quot;q&quot;>
Select model, count(model) as Total
From vehicle
Group By model
</cfquery> <CFQuote>THE JOURNEY OF A 1000 MILES BEGINS WITH 1 STEP</CFQuote>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top