Hi
The following SQL statement is taking a long time to execute. If one of the tables that it queries has around 30 or so records in it, it takes up to 30 seconds to execute.
SELECT DISTINCT(jobseeker.JobSeekerID) FROM jobseeker,relocatecountryselected, relocateregionselected, jobseekerlanguage,workpermitscountryselected,educationselected WHERE jobseeker.JobSeekerID = relocatecountryselected.JobSeekerID AND jobseeker.JobSeekerID = relocateregionselected.JobSeekerID AND jobseeker.JobSeekerID = jobseekerlanguage.JobSeekerID AND jobseeker.JobSeekerID = workpermitscountryselected.JobSeekerID AND jobseeker.JobSeekerID = educationselected.JobSeekerID
All that is happening here is that tables are being joined by the JobSeekerID. Each of the tables (except table jobseeker) might have the JobSeekerID more than once. e.g. a jobseeker may want to relocate to more than one country, and therefore the relocatecountryselected table will have the same JobSeekerID in it more than once. That's also why I use DISTINCT, since I just want the Distinct JobSeekerID returned, even if they are relocating to more than one country.
Any ideas why it's taking so long to execute? It eventually gets there, just takes forever.
Do you need more info? Should I use different SQL?
Many thanks
H
(This is just a part of the query. I append stuff to it, but that isn't causing any problems. )