Member of the LearnItFirst.com Video Training Network | LearnSqlServer.com | SQL SSIS Training | SQL Programming Tutorials |
LearnSqlServer.com Forums LearnSqlServer.com
Welcome Guest Search | New Posts | Members | Log In | Register

counting rows based on criteria Options
dmikester1
Posted: Tuesday, June 24, 2008 9:43:02 AM
Rank: Newbie

Joined: 6/23/2008
Posts: 4
Points: 12
Location: WI
In one of my tables I have a field called TXYEAR. I would like to generate a count for each TXYEAR. So like this:
TXYEAR COUNT
1994 2
1995 2
1996 3
1997 4

etc. etc.

Thank you.
Mike
Scott Whigham
Posted: Friday, June 27, 2008 1:58:27 PM


Rank: Super Mod

Joined: 3/20/2006
Posts: 329
Points: 700
Location: Dallas, TX
SELECT TXYEAR, COUNT(*) FROM MyTable GROUP BY TXYEAR

Is that all you need? Seems simplistic - maybe I'm missing something?
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
     
Don't Forget!
LearnItFirst.com
Don't Forget!
LearnSqlServe.com
 
Home | About Us | Support | Contact Us | Privacy | Site Map | Blogs Blogs Refer a Friend and Get a Free Subscription!
© Copyright 2004-2007 LearnItFirst.com LLC. All rights reserved. All trademarks remain the property of their respective owners.
This site is not affiliated in any way with the Microsoft Corporation.