All,
I have 2 tables with a lot of columns with similar names. I'd like to
join both tables and include all columns from each without naming
collisions. I can use the 'AS' to rename a single column, but is there
a way to do the rename in bulk by just appending a prefix or suffix to
the column names from each respective table?
I want to do something like this:
SELECT a.* AS prefix1_*, b.* AS prefix2_*
FROM a, b
WHERE a.id = b.id
AND a.id = 123;
The result would be to select all columns from "a" but rename each to
have "prefix1_" appended to the front.
a.id -> prefix1_id
b.id -> prefix2_id
a.xpos -> prefix1_xpos
b.xpos -> prefix2_xpos
a.ypos -> prefix1_ypos
b.ypos -> prefix2_ypos
etc...
Does this request make sense? Does something like this exist? I don't
really NEED to have this, I'm just trying to be lazy.
-- Dante