Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with join query - One step futher.

Status
Not open for further replies.

McKaulick

Programmer
Oct 24, 2002
35
0
0
AR
Problem doind a query - 3 tables.

Hello everyone, first of all, thanks to r937 for answering my last question.

Here's the deal, I have table call ContactSkill with 2 fields

1)Contact_key
2)Skill_Key

And another one call Search_Skill with 2 fields

1) Skill_Key
2) Search_Key

I want to retrive all contact_key that have all the skills selected from a given search_key

Here was the query r937 suggested which works fine:

select co_vi.fk_contact_key as conkey
from search_skills as se_vi
inner
join contact_skills as co_ski
on co_vi.fk_skills_uid = se_vi.fk_skills_uid
where se_vi.fk_search_sn = 'co8t1usouxwapqc7oc8o'
group
by conkey
having count(*)
= ( select count(*)
from search_skills
where fk_search_sn = 'co8t1usouxwapqc7oc8o' )

Now what if I want to improve that.

On my search user can select skill, title and employer, tables logic are the same then above

ContactTitle with 2 fields

1)Contact_key
2)Title_Key

Search_Title with 2 fields

1) Title_Key
2) Search_Key

AND

ContactEmployer with 2 fields

1)Contact_key
2)Employer_Key

Search_Employer with 2 fields

1) Employer_Key
2) Search_Key

Now, can I have one big query that look for all that?

Like if user select 2 skills, 1 title and 4 employers, I want the result to be only the contacts that have those very choices.

Hope it's clear, and thanks for any help.

McKaulick

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top