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.
Author |
Topic |
skes1
Starting Member
4 Posts |
Posted - 2010-02-11 : 11:35:27
|
I was looking for input on querying a cross reference table.The table has two columns: Candidate_ID and Experience_IDA candidate can have multiple experiences and the XREF table is structured to align candidate_ID to experience_ID. For example, If a candidate is assigned 3 experience_ID's, then the XREF table would have three rows. CAN_ID.......... EXP_ID16................10116................10216................103When I run a query on the XREF table, for example, to show all candidates who have Airport AND Bridge experience I can't get return results where both values were true. The query returns no rows.SELECT CANDIDATE_XREF.CANDIDATE_ID FROM CANDIDATE_XREF WHERE CANDIDATE_XREF.EXPERIENCE_ID=@DDLA AND CANDIDATE_XREF.EXPERIENCE_ID=@DDLB@DDLA is value of drop menu 1@DDLB is value of drop menu 2 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-11 : 11:38:00
|
[code]SELECT CANDIDATE_XREF.CANDIDATE_ID FROM CANDIDATE_XREF WHERE CANDIDATE_XREF.EXPERIENCE_ID IN (@DDLA,@DDLB) GROUP BY CANDIDATE_XREF.CANDIDATE_ID HAVING COUNT(DISTINCT CANDIDATE_XREF.EXPERIENCE_ID) =2[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
skes1
Starting Member
4 Posts |
Posted - 2010-02-11 : 12:48:38
|
THANK YOU VERY MUCH! Worked Great! |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-11 : 12:50:57
|
welcome ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|