Forum Discussion
Neha11
Mar 08, 2022Copper Contributor
Lead function error
Hi,
I have lead function after on clause as one of the conditions in join
Gives an error to me as "misuse of window function lead()"
Pls help
I have lead function after on clause as one of the conditions in join
Gives an error to me as "misuse of window function lead()"
Pls help
Neha11 , a Windows function like LEAD is a post operation, you can not use it in a JOIN condition or in a WHERE clause, only in the SELECT clause.
One way round is to use a CTE = Common Table Expression to re-use the query result.
Olaf
- olafhelperBronze Contributor
Neha11 , a Windows function like LEAD is a post operation, you can not use it in a JOIN condition or in a WHERE clause, only in the SELECT clause.
One way round is to use a CTE = Common Table Expression to re-use the query result.
Olaf
- Neha11Copper Contributor