Say I have two tables, and they have several column names that are the same
in both tables. I know I can manually alias the column names so that they
don't overlap, but is there a way to prefix *all* of the columns of one
table so that I can be sure the names don't overlap?
So if I have these two tables:
person: id,name,age,home_id
place: id,name,zip_code
then I could use a query like:
SELECT
person.*,place.* as home_*
FROM
person,place
WHERE
person.home_id = place.id
AND
name = 'Joe'
To get back results like:
id,name,age,home_id,home_name,home_zip_code
The problem is that I don't want to have to update my queries everytime I
add a new column, so I use table_name.* a lot. But then if I ever add a
column with the same name to another table, I will only get one column or
the other back.
Does MySQL do this? Should it?
- Isaac