Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 457
  • 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

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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