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)
+2
A:
us the AS keyword
select a.Price as PriceOne, b.price as PriceTwo
from tablea a, tableb b
Dead account
2009-03-05 10:27:50
+5
A:
select t1.Column as Price, t2.Column as Other_Price
from table1 as t1 INNER JOIN table2 as t2
ON t1.Key = t2.Key
like this ?
Matt
2009-03-05 10:28:19
A:
if you are using sql server, use brackets or single quotes around alias name in a query you have in code.
Kunal S
2009-03-05 10:41:17