Home > Back-end >  Subquery as offset argument - LAG() Function in DB2
Subquery as offset argument - LAG() Function in DB2

Time:02-23

I would like to ask a question. Generally, we know that LAG() function can be expressed as LAG(column expression, Offset,[default value]) OVER(ORDER BY . . .) . Does anyone know if the offset can be a subquery in db2?

I try to insert a subquery and to cast the result as integer with no result.

Thank you in Advance!

CodePudding user response:

Manual : https://www.ibm.com/docs/en/informix-servers/12.10?topic=expressions-lag-lead-functions

Quote:

offset

Non-negative integer constant defining an offset from the position of the current row

...

Literal integer

So, no, you can't use a sub-query

  • Related