sql - How do I specify column to to select from result of join -


my table ce_data has column "fut_id"

why "ambiguous" error on first line? tx."fut_id" not work either

select "fut_id" ( select *   "ce_data" m   join (select "fut_id", max("date") "most_recent"           "ce_data"          group "fut_id"        ) r     on r."fut_id" = m."fut_id" , r."most_recent" = m."date" ) tx 

the outer query picks fut_id inner subquery. there two different sources choose fut_id from: table ce_data (alias m) and derived table alias r. can work around problem using alias field within derived table:

select "fut_id" ( select *   "ce_data" m   join (select "fut_id" "fut_id2", max("date") "most_recent"           "ce_data"          group "fut_id"        ) r     on r."fut_id2" = m."fut_id" , r."most_recent" = m."date" ) tx 

Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -