Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 stuck....

Author  Topic 

yakoo
Constraint Violating Yak Guru

312 Posts

Posted - 2001-12-12 : 15:52:46
I have a table called resume_skills with the following info


RESUME_ID SKILL_ID
----------------------
958 1
958 2
958 3
959 1
959 2
960 1


Im looking for a way to query this table to return the resume_id that has some specified skill.

For example. If im looking to get resume_ids which have skill_id of 1, 2, and 3 I want 958 returned. If i want 1 and 2 then 958 and 959 are returned. If I just want resume_ids that have a skill set of 1 I want 958, 959, and 960 (which I can do).

Any help is appreciated

benricho
Yak Posting Veteran

84 Posts

Posted - 2001-12-12 : 16:02:12
Will they always be in numeric order, or is it possible that you might want the resume_ids that have a skill set of 1 and 3?

Go to Top of Page

yakoo
Constraint Violating Yak Guru

312 Posts

Posted - 2001-12-12 : 16:03:49
it could be 1 and 3

which should return only 958 then

Go to Top of Page

LarsG
Constraint Violating Yak Guru

284 Posts

Posted - 2001-12-12 : 16:10:11
select resume_id
from resume_skills
where skill_id in (1,2,3)
group by resume_id
having count(*) = 3



Edited by - LarsG on 12/12/2001 17:08:54
Go to Top of Page

yakoo
Constraint Violating Yak Guru

312 Posts

Posted - 2001-12-12 : 16:11:52
i just got it to work and then saw your post.

here is what I did


select count(*), s.resume_id from (select resume_id from resume_skills where skill_id=11 or skill_id=9) s group by resume_id having count(*) >= 2




thanks guys

Go to Top of Page

yakoo
Constraint Violating Yak Guru

312 Posts

Posted - 2001-12-12 : 16:13:05
quote:

select resume_id
from resume_skills
where skill_id in (1,2,3)
group by skill_id
having count(*) = 3





wouldnt it have to be group by resume_id having count(*) = 3?

Go to Top of Page

ToddV
Posting Yak Master

218 Posts

Posted - 2001-12-12 : 16:36:37
quote:


wouldnt it have to be group by resume_id having count(*) = 3?





yes

Go to Top of Page
   

- Advertisement -