Reputation: 10713
I've been trying to select everything from two tables at the same time.
Unfortunately, I didn't create the database and I can't just merge it into one table.
I tried this, but it doesn't work:
(SELECT * FROM 'contacts') UNION (SELECT * FROM 'signup')
Both tables are the same. This doesn't work though :(
Upvotes: 1
Views: 2585
Reputation: 2719
Can't you just do:
SELECT * FROM contacts, signup;
Or am I not understanding your question?
EDIT:
Try this instead if you're looking for a UNION:
SELECT * FROM contacts
UNION
SELECT * FROM signup;
Upvotes: 2
Reputation: 191809
Your syntax is incorrect. Tables should not be quoted by apostrophes. They can (but don't have to be) quoted by backticks.
SELECT columns FROM contacts UNION SELECT columns FROM signup
Replace columns
with the columns you want to select. Also note that this will select all of the contacts
rows first followed by the signup
rows.
Upvotes: 1