重写旧sql但两条sql结果不一样

问题描述 投票:0回答:1

我想重写旧的sql

select *  from a, b, c where a.columnA = b.columnB and a.columnC *= c.columnD and a.columnE *= c.columnF

我尝试如下

select * from a join b on a.columnA = b.columnB left join c on a.columnC = c.columnD left join c on a.columnE = c.columnF

但是两条sql的结果不一样。 请帮忙。

sybase ansi-sql
1个回答
0
投票

将两个

left join
列合并为一个
left join
子句,例如:

select * 
from   a

join   b 
on     a.columnA = b.columnB

left
join   c 
on     a.columnC = c.columnD
and    a.columnE = c.columnF
© www.soinside.com 2019 - 2024. All rights reserved.