Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I want to know how to write the below statement in SQL. Could anyone help me with this please?
if([Customer Number]=Previous([Customer Number]),Peek('Sequence')+1,1) as [Sequence]
Thanks in advance
Anusha
Check lag and lead functions in sql.
lag for previous row.
https://docs.microsoft.com/de-de/sql/t-sql/functions/lag-transact-sql?view=sql-server-ver15
lead for next row.
https://docs.microsoft.com/de-de/sql/t-sql/functions/lead-transact-sql?view=sql-server-ver15
regards
tim