SELECT name,trans FROM skyplan_deploy.deploy_stars d WHERE d.apt='KOPF' AND d.name!=d.trans
LEFT OUTER JOIN
(SELECT distinct c.star_ident,c.fix_ident from corept.std_star_leg c
INNER JOIN
(SELECT star_ident,transition_ident,max(sequence_num) seq,route_type
FROM corept.std_star_leg
WHERE data_supplier='J' AND airport_ident='KOPF'
group by star_ident,transition_ident)b
ON c.sequence_num=b.seq and c.star_ident=b.star_ident and c.transition_ident=b.transition_ident) as y
ON c.sid_ident=x.name AND c.fix_ident=x.trans
where y.data_supplier='J' and y.airport_ident='KOPF' and y.name is null;
在执行上述查询时,我收到以下语法错误。
您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以获得在“左外连接”附近使用的正确语法
(SELECT distinct c.star_ident,c.fix_ident from corept.std_sta' 在第 3 行
我使用了左连接,以便我可以从上述两个查询中获取数据差异。我什至将 where 条件放在最后。