Ryan Bayne
asked on
Using UNION to join to SELECT statements with WHERE then variable='columname';
Hi, well this is whatI tried...
SELECT * FROM users WHERE email='$email'
UNION
SELECT * FROM temp_members_db WHERE email='$email'
I want to check if a new registrations email address is already owned by an existing member and possibly a member awaiting activation which are stored in seperate table. I will need to do the same with username.
Am I way off or on right track?
thanks
SELECT * FROM users WHERE email='$email'
UNION
SELECT * FROM temp_members_db WHERE email='$email'
I want to check if a new registrations email address is already owned by an existing member and possibly a member awaiting activation which are stored in seperate table. I will need to do the same with username.
Am I way off or on right track?
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
folderol,
I think what he's trying to discover is if the $email value exists in either table then he wants to tell the potential new user that the email address he submitted already exists either as an activated member or one awaiting activation.
I think what he's trying to discover is if the $email value exists in either table then he wants to tell the potential new user that the email address he submitted already exists either as an activated member or one awaiting activation.
ASKER
Yes this is what I needed. Another something learned, define everything else have matching structures.
Cheers for the help. I did manage to do it from the first comment but the 2nd adds to the question so will issue some points.
Cheers for the help. I did manage to do it from the first comment but the 2nd adds to the question so will issue some points.
SELECT email FROM users WHERE
email='$email'
UNION
SELECT email FROM temp_members_db
WHERE email='$email'"
ASKER
cheers