Hi, I need a query that checks 4 different tables, to see if there is a match for the username/password filled in the form. 4 tables sounds kinda weird but it's pretty clear. I have 3 different people who can login. Students, companies and admins. Each has there own table with data, but company has 2 tables. 1 for companyname en 1 for departments.
But only the company table en department table are linked together. I have this at the moment but if there is a match from 1 table, I get data from all fields that are mentioned in the select. I hope that you understand, been strugeling with it for some hours now, so hope you can help.
This is the query I have at the moment:
SELECT student_id, admin_id
FROM students, admin
(student_id = '8563' AND students.password= MD5('password'))
(admin_id = '8563' AND admin.password= MD5('password'))
The output I get:
The combination for student was correct, but because I don't connect the 2 tables I get a result from the other table back aswell. But I don't want that result, only if the combination doesn't match in the table student but in the table admin. So it's impossible to see now in which table the match was.
Hope you still understand, my english sucks a little