I Have Three Table Here
First Table :

Second Table

Third table

I Have Update First Table Column OTD Like Query Here:
Update P Set OTD= (Select Case When max(DT)<= PD.DTWax Then 1 Else 0 End From PRCWax Where PRCNO=P.PRCNO Group By PD.PRCNO) From PRC As P Left Outer Join PRC_Day As PD ON PD.PRCNO=P.PRCNO
But Sql Error Here
Each GROUP BY expression must contain at least one column that is not an outer reference
How It possible
Thank in Advance
Aravind GovindarajPosted Dec 5, 2022, 4:21 PM
I assume you need to use the rank concept, where rank of PRCWax with prd_day then you will apply 1/0 in PRC table.