March 23, 2009 at 11:54 am
I have looked through old threads, and could not find this addressed. Basically I have a query that identifies various transactions. Each transaction has a corresponding employee ID attached. Is there a way to pull up these transactions, and display how many times each ID appears in the results? So ultimately, I can say employee 'X' has 32 transactions and employee 'Y' has 15.
March 23, 2009 at 11:57 am
Look up Count in Books Online, and Group By.
Basically, it's going to look like:
select EmployeeID, count(*)
from dbo.MyTable
group by EmployeeID;
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
March 23, 2009 at 12:25 pm
Thanks! Worked like a charm.
March 23, 2009 at 4:50 pm
I'd recommend learning some of the basics...
--Jeff Moden
Change is inevitable... Change for the better is not.
March 24, 2009 at 6:23 am
*Bookmarked* Thanks.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy