当前位置: 代码迷 >> Oracle管理 >> sql语句查两张表,两张表里有相同的列 ,这俩列如何区别是那个表的
  详细解决方案

sql语句查两张表,两张表里有相同的列 ,这俩列如何区别是那个表的

热度:83   发布时间:2016-04-24 05:49:42.0
sql语句查两张表,两张表里有相同的列 ,这俩列怎么区别是那个表的
select a.ssgdgx , a.gh, a.dj, a.xh, b.xh, b.tggg, b.yt, b.jgdate, b.nbid from
table1 a, table2 b where a.dgid = b.id and ssgdgx like '%X0001455@%'
  
这是两张表 table1 和表 table2
 根据条件查出内容后 有两列是 xh , 想知道用什么方法可以将这俩列区分开


------解决方案--------------------
--给查出来的字段加别名:
select a.ssgdgx , a.gh, a.dj, 
a.xh as a_xh, b.xh as b_xh, b.tggg, b.yt, b.jgdate, b.nbid from
table1 a, table2 b where a.dgid = b.id and ssgdgx like '%X0001455@%'
  相关解决方案