Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I rename a single column in a table at select?

Tags:

sql

I have two tables with one identical column name, but different data. I want to join the tables, but access both columns (row["price"], row["other_price"]): How can I rename/alias one of them in the select statement? (I do not want to rename them in the DB)

like image 208
akosch Avatar asked Mar 05 '09 10:03

akosch


1 Answers

select table1.price, table2.price as other_price .....

like image 60
MrTelly Avatar answered Oct 02 '22 15:10

MrTelly