With regular ISO window functions, one could typically write something along 
these lines:

with
DataSet
as
(
   select  foo.*,
           lag( 0, 1, 1 ) over ( partition by id order by time ) as is_lag
   from    foo
)
select  *
from    DataSet

where   DataSet.is_lag = 1

you're right. it was my fault and teradata is not guilty at all - they still allow to write it easier than standard: select * from tab qualify row_number() over(partition by id order by mtime) = 1
or if you prefer:
select * from tab qualify lag(0, 1, 1) over(partition by id order by mtime) = 1


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to