using LAG() and MIN() functions
574757Dec 3 2008 — edited Dec 3 2008So, i am trying to get the smallest number from an aliased column that i am using LAG() in. I know, that does not make sense, so here is what im trying to do with a SQL statement:
select MIN(NUM1 - lag(num1,1,0)) over(ORDER BY NUM1) AS HEY from J_LAG ORDER BY HEY
basically, i want the smallest number from the column that i run the lag function on. When I try to do this it says, "ORA-30484: missing window specification for this function". I have tried putting the min's brackets like this: MIN(NUM1 - lag(num1,1,0)) and like this: MIN(NUM1 - lag(num1,1,0) over(ORDER BY NUM1)) and neither of them seem to work.
Any ideas??
-- Joshua