復制代碼 代碼如下:
select * from _test a left join _test b on a.id=b.id where a.level='20' and a.month='04' and b.level='20' and b.month='03';
select a.*,b.* from (select * from _test where level='20' and month='04') as a left join (select * from _test where level='20' and month='03') as b on a.id=b.id;
這兩條語句結果是不同的,應該是left join的時候如果條件是多個表mysql會自動轉成內聯導致,第二條語句才能達到正確的目的(為了找到相差的兩條數據)。