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;
這兩條語句結(jié)果是不同的,應(yīng)該是left join的時候如果條件是多個表mysql會自動轉(zhuǎn)成內(nèi)聯(lián)導(dǎo)致,第二條語句才能達(dá)到正確的目的(為了找到相差的兩條數(shù)據(jù))。