i tried unable return rows. it's returning rows left query. please find bug.
select c.star_ident, c.fix_ident corept.std_star_leg c inner join ( select star_ident, transition_ident, max(sequence_num) seq, route_type corept.std_star_leg data_supplier='j' , airport_ident='kopf' group star_ident,transition_ident ) b on c.sequence_num=b.seq , c.star_ident=b.star_ident , c.transition_ident=b.transition_ident left outer join ( select name, trans skyplan_deploy.deploy_stars d apt='kopf' , name!=trans ) x on x.name=c.star_ident , x.trans=c.transition_ident c.data_supplier='j' , c.airport_ident='kopf' , x.name null;
let corept.std_star_leg
table this.
star_ident transition_ident sequence_num fix_ident airport xx 10 qwe kopf xx 20 wer kopf xx 30 hyu kopf xx 40 gji kopf b yy 10 sji kopf b yy 20 dji kopf b yy 30 fji kopf b yy 40 ghi kopf b yy 50 kdi kopf
after performing inner join result obtained follows.
a xx 40 gji b yy 50 kdi
thus retrieving max sequence_num
rows. after skyplan_deploy.deploy_stars
table follows.
apt name trans kopf fji kopf dhi kopf b vnm
i need output
a gji b kdi
this may work.check out once.
select distinct c.airport_ident,c.sid_ident,c.transition_ident,c.fix_ident corept.std_sid_leg c inner join (select sid_ident,transition_ident,max(sequence_num) seq,route_type corept.std_sid_leg data_supplier='j' , airport_ident='kopf' group sid_ident,transition_ident)b on c.sequence_num=b.seq , c.sid_ident=b.sid_ident , c.transition_ident=b.transition_ident left join (select name,trans skyplan_deploy.deploy_sids apt='kopf' , name!=trans) d on d.name=c.sid_ident , d.trans=c.fix_ident c.data_supplier='j' , c.airport_ident='kopf' , d.name null
Comments
Post a Comment