I have the following Update query that needs to include price from another year if no price exist for matching year.
set Price = PL.[UPrice]
from #Results R inner join PriceList PL on R.Item = PL.Item and Left(R.Itemdate, 4) = convert(varchar(4), PL.FY)
So for the part
Left(R.Itemdate, 4) = convert(varchar(4), PL.FY)
How can I change it if there is no match for Itemdate, it looks for the most current date in PriceList?
Part of a stored procedure in SQL Server 2008.