select CustCode,* from solist a where not exists(select 1 from SOList(nolock) left join so(nolock) on solist.soid=so.SOID where a.ConfirmDate>solist.ConfirmDate )