In mySQL, Is it possible to SELECT from two tables and merge the columns?
Posted
by Travis
on Stack Overflow
See other posts from Stack Overflow
or by Travis
Published on 2010-05-26T13:25:38Z
Indexed on
2010/05/26
13:31 UTC
Read the original article
Hit count: 220
If I have two tables in mysql that have similar columns...
TABLEA
id
name
somefield1
TABLEB
id
name
somefield1
somefield2
How do I structure a SELECT statement so that I can SELECT from both tables simultaneously, and have the result sets merged for the columns that are the same?
So for example, I am hoping to do something like...
SELECT name, somefield1 FROM TABLEA, TABLEB WHERE name="mooseburgers";
...and have the name, and somefield1 columns from both tables merged together in the result set.
Thank-you for your help!
© Stack Overflow or respective owner