SQL join problem
Hi,
I need to check if the same ID exists in all tables, so I am using a join, but I have 2 tables (Employment, Education) where the ID is not a primary key and the ID appears several times in these tables.
So I just need to check if the ID appears once, do you know how I can do this?
So far I have the SQL below but it doesnt work, as you can see there are 12 rows when I want to only get 2
Any help would be much appreciated.
----------------SQL--------------------
SELECT loginid, pdloginid, eloginid, EOloginid, rloginid, sloginid, edloginid
FROM login, personaldetails, employment, equalopps, referee, education, skills
WHERE (login.loginid = personaldetails.pdloginid
AND login.loginid = education.edloginid AND login.loginid = equalopps.EOloginid
AND login.loginid = referee.rloginid
AND login.loginid = employment.eloginid AND login.loginid = skills.sloginid)
----------------------------------------
RESULT
11 11 11 11 11 11 11
11 11 11 11 11 11 11
11 11 11 11 11 11 11
11 11 11 11 11 11 11
11 11 11 11 11 11 11
11 11 11 11 11 11 11
11 11 11 11 11 11 11
11 11 11 11 11 11 11
11 11 11 11 11 11 11
2 2 2 2 2 2 2
2 2 2 2 2 2 2
2 2 2 2 2 2 2
|