I am trying to optimize the following query, According to execution plan, the sort in the inner query has a high cost. could the following query be re-written so that its easy to read and performs well?
select
CL.col1, CL.col2
FROM
CLAIM CL WITH (NOLOCK)
INNER JOIN MEMBER MEM WITH (NOLOCK) ON MEM.MEMID=CL.MEMID
LEFT JOIN PAYVACATION PV WITH (NOLOCK) ON CL.CLAIMID = PV.CLAIMID
and pv.paymentid =
(select top 1 PAYVACATION.paymentid
from PAYVACATION WITH (NOLOCK),
payment WITH (NOLOCK)
where
payvoucher.claimid = cl.claimid
and PAYVACATION.paymentid = payment.paymentid
order by payment.paystatusdate desc)