i have the following query (to select dupes-- a record in both tables based off btn and completed [dispo 80]) which works fine, but I'm using a join to get only 1 date field before i do an inline select on the same table. I'm wondering if there's a better way to get the same data without the join?
any suggestions on improvements?Code:SELECT s.idate AS 'Date of Sales Call', t.idate AS 'Date of TPV Call', s.btn AS 'Billing Telephone Number', s.eon AS 'Order Number', s.cust_first_name AS 'Customer First Name', s.cust_last_name AS 'Customer Last Name', s.loa AS 'LOA' FROM sale s LEFT OUTER JOIN tpv t on t.btn = s.btn AND t.dispo = '80' WHERE fn_dateonly(s.idate) = fn_dateonly(getdate() -1) AND s.dispo = '80' AND s.btn IN ( SELECT btn from tpv where fn_dateonly(idate) = fn_dateonly(getdate() -1) AND dispo = '80' )









Bookmarks