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
- Mar 08, 2022
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
olafhelper
Mar 08, 2022Bronze 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
Neha11
Mar 08, 2022Copper Contributor