I have 2 tables - 'users' and 'staffs'. 'users' contains the login information for the public wears while 'staffs' contains the login information for the administrators. In my login page, both users and staffs are able to login through the same webpage. For the login verification, how should I write my SQLquery so that it can retrieve users(email, user_password) and staffs(staffmail, password) to verify?
My current SQL codes are:
SELECT first_name, last_name from users
union all
SELECT staffname, staffrole from staffs
WHERE email = 'glenn@hotmail.com' and user_password = '112'
OR staffmail ='joe@aventis.edu.sg' and password = 'joe123'
However, this will not be able to generate any outputs.