我有兩個查詢導致兩個結果集需要比較兩個結果集並需要顯示它們之間的差異。希望我會得到很好的支持。謝謝。這些是我的查詢獲取兩個查詢之間的數據差異
查詢:1個
SELECT distinct c.sid_ident,c.fix_ident from corept.std_sid_leg as c INNER JOIN (SELECT sid_ident, transition_ident, max(sequence_num) seq, route_type FROM corept.std_sid_leg WHERE data_supplier='J' AND airport_ident='KBOS' GROUP BY sid_ident,transition_ident) b ON c.sequence_num=b.seq and c.sid_ident = b.sid_ident and c.transition_ident =b.transition_ident WHERE c.data_supplier='J' and c.airport_ident='KBOS';
查詢:2
SELECT name,trans FROM skyplan_deploy.deploy_sids ON d.name=c.sid_ident WHERE apt = 'KBOS' AND name != trans;
比較是必須要做的上字段在skplan_deplay.deploy_sids corept.std_sid_leg和名稱sid_ident。由於Mysql不支持完整的外連接,所以我想使用左連接和右連接並結合兩個結果。但是我堅持這樣做。請幫助。我在使用左右連接時出現語法錯誤。謝謝。
我提供的語法使用LEFT JOIN以及右join..so,我可以既工會結果 – user2037445 2013-03-21 09:05:02
使用搜索功能始終是一個良好的開端,以上述兩種查詢組合。把你的查詢放入子查詢並閱讀:http://stackoverflow.com/questions/4796872/full-outer-join-in-mysql – fancyPants 2013-03-21 09:45:38