January 6, 2005 at 8:39 pm
I wasn't able to do it in one query -- maybe someone else will figure that out.
Here is an example involving 2 steps:
insert into stats select 1,2
insert into stats select 1,3
insert into stats select 1,4
insert into stats select 1,5
insert into stats select 1,6
insert into stats select 1,7
insert into stats select 1,8
insert into stats select 1,9
insert into stats select 2,1
insert into stats select 2,2
insert into stats select 2,3
insert into stats select 2,4
insert into stats select 2,1
insert into stats select 2,2
insert into stats select 2,3
insert into stats select 2,4
insert into stats select 3,1
insert into stats select 3,2
insert into stats select 3,3
insert into stats select 3,4
insert into stats select 3,5
insert into stats select 3,6
into #temp
from stats
where teamId in (1,2,3,4,5,6)
group by playerID, teamID
-----------
1
3
Aunt Kathi Data Platform MVP
Author of Expert T-SQL Window Functions
Simple-Talk Editor
January 7, 2005 at 6:56 am
from (select distinct playerID,teamId
where teamId in (1,2,3,4,5,6)) a
group by playerID
Far away is close at hand in the images of elsewhere.
Anon.
January 7, 2005 at 5:28 pm
Thanks very much...that did it. And the answer is that no player ever played for all Original 6 teams, but 6 played for 5 of the teams. Thanks
JW
Viewing 3 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply