So what do you do in the situation where you have two tables such as 'product' and 'category' and they both have a column named 'description'. If you do a simple * and join the tables, the resulting set of data will have a duplicate field.
Code:
select * from product p, category c where p.id=c.id;
result->description = ???
Yes you could do this:
Code:
select p.description as `product.description`,
c.description as `category.description` etc..
.
But that means any time you change the database, you have to update all your data access code.
Is it recommended to alias each column on every query as I've done in the 2nd query above?
Bookmarks