Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 461
  • Last Modified:

Sql select count and distinct...

I have this query which returns car manufacturers...
SELECT DISTINCT [Make] FROM [VehicleSpecs] ORDER BY [Make]

How can I modifiy this query to also return the count for each make?

0
evo_x
Asked:
evo_x
  • 2
  • 2
1 Solution
 
derekkrommCommented:
SELECT [Make],count(*) FROM [VehicleSpecs] group by [Make] ORDER BY [Make]
0
 
evo_xAuthor Commented:
But how can I assign a field name to count ? because this way I can't assign the count field to the asp.net control.
0
 
derekkrommCommented:
SELECT [Make],count(*) as [MakeCount] FROM [VehicleSpecs] group by [Make] ORDER BY [Make]
0
 
evo_xAuthor Commented:
Thanks !
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now