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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

logic mistake - please help me find it!!

Status
Not open for further replies.

frogggg

Programmer
Jan 17, 2002
182
US
This is my sql statement. It should retrieve all records which have the specified location, jobcategory, career, and skill for one candidate. Instead, it invents a record that's mix and match. The location, jobcategory, career and skill specified, but that are not all related to one candidate! For example, the location, jobcategory, and career desired belong to one candidate, and the skill belongs to another, it displays all the requested info, with the candidateID of the last candidate, if that makes any sense.
Here's my sql statement. Can anyone find my logic mistake? Please!!??

SELECT JobCategory.JobCatName, CareerLevel.CareerName, CandidateContactInfo.CandidateID, Locations.LocationName, SkillCategory.SkillName " _
& "FROM CandidateContactInfo, CandidateJobCategory, JobCategory, CareerLevel, Locations, CandidateLocations, SkillCategory, CandidateSkills " _
& "WHERE CandidateJobCategory.JobCatID IN (" & jobCategories & ")" _
& "AND CandidateJobCategory.JobCatID = JobCategory.JobCatID " _
& "AND CandidateContactInfo.CareerLevel = CareerLevel.CareerID " _
& "AND CandidateContactInfo.CareerLevel IN (" & careers & ")" _
& "AND CandidateLocations.LocationID IN (" & locations & ")" _
& "AND CandidateLocations.LocationID = Locations.LocationID " _
& "AND CandidateSkills.SkillID = SkillCategory.SkillID " _
& "AND CandidateSkills.SkillID IN (" & skills & ")" _
& "AND CandidateContactInfo.CandidateID = CandidateJobCategory.CandidateID

Thanks in advance!
 
Why are you using the " IN " clause and where do the variables there come from?

One of the things is that you are creating large theta joins on your related tables. If you were to set up the sql using joins you may have more luck Derren
[Mediocre talent - spread really thin]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top