sql - Use analytic function result in where clouse -


i got statement:

select ar.*, lag(dest_time, 1) on (order fep_id) hit  dsyy.archiv ar; 

it works pretty fine. want that:

select ar.*,     lag(dest_time, 1) on (order fep_id) hit      dsyy.archiv ar      arr_time < hit; 

unfortunality not allowed... tell me how can deal column hit inside where-clouse?

thx lot

simply use subquery:

select ar.* (select ar.*,              lag(dest_time, 1) on (order fep_id) hit        dsyy.archiv ar       ) ar arr_time < hit; 

Comments

Popular posts from this blog

pentaho - Carte Status / Kettle Slave Server Status page shows status for random runs instead of the latest run -

R summary function in ddply (plyr) in a simple way -

c# - Are delegates created via lambda expressions guaranteed to be cached? -