I have done allot of reading about this and it seems that isn't possible. The thing is, since the amount of columns is dynamic i cant explicitly mention them. I put in aliases but the 'id' column keeps on appearing.
The CREATE
doesnt work since there is 3 id
columns in there, obiously.
(This query actually is ok, it works so dont evaluate it please)
CREATE TABLE merged as
SELECT *,
wuwebusers.id as wuwebusers_id,
jgwebusers_address.id as jgwebusers_address_id,
jgwebusers.id as jgwebusers_id
FROM wuwebusers
LEFT OUTER JOIN jgwebusers_address ON wuwebusers.id = jgwebusers_address.userid
LEFT OUTER JOIN jgwebusers ON wuwebusers.id = jgwebusers.userid
GROUP BY wuwebusers.id
EDIT: question: how can i select every column except a few explicit ones. I know SELECT * isn't the correct way, since i am selecting all. I am asking for other way(s).
Since i have to do this a few times and the columns are dynamic and quite a few it isn't maintainable by explicitly writing every column name.