Counting Duplicates Query

rfear

Registered User.
Local time
Today, 04:28
Joined
Dec 15, 2004
Messages
83
How do I query data like this :-

Year Week
2006 10
2006 25
2007 10
2007 10
2007 20
2008 20
2008 20

to turn it into this :-

Year Week Arrival Rate
2006 10 1
2006 25 1
2007 10 2
2007 20 1
2008 20 2

I can find loads about finding duplicates, deleting duplicates, hiding duplicates but not much on counting them ?
 
You might try the following (substitute highlighted text with the appropriate table/field names):
Code:
SELECT T1.[B][I]Year[/I][/B], T1.[B][I]Week[/I][/B], Count(T1.[B][I]Week[/I][/B]) AS [Arrival Rate]
FROM [B][I]MyTable[/I][/B] T1
GROUP BY T1.[B][I]Year[/I][/B], T1.[B][I]Week[/I][/B];
 
Awesome, worked first time :) thanks.
 

Users who are viewing this thread

Back
Top Bottom