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
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