I have 2 tables that are being populated from a .Net Application. The inserts are happening one after the other. Occasionally the 2nd falls 1 second after the 1st.
The Key for these 2 tables are LnId, UserId, and TransDate
I have accounted for the time difference with the following, but I am now being asked for the Date range twice. Is there a better way to accomplish this that won't ask me for my date range twice?
SELECT tblTransactions.LnNumber, tblTransactions.TransDate, tblCallCatValues.Level2, tblReRegTransactions.OldLoan, tblReRegTransactions.NewLoan, tblReRegTransactions.Reason
FROM (tblTransactions INNER JOIN tblCallCatValues ON tblTransactions.CallCategory = tblCallCatValues.CatValue) LEFT JOIN tblReRegTransactions ON (tblTransactions.LnNumber = tblReRegTransactions.LnId) AND (tblTransactions.PricerID = tblReRegTransactions.UserId) AND (datediff("s",tblTransactions.TransDate , tblReRegTransactions.TransDate) =1) OR (datediff("s",tblTransactions.TransDate , tblReRegTransactions.TransDate) =0)
WHERE (((tblTransactions.TransDate)>[StartDate] And (tblTransactions.TransDate)<[EndDateComp]) AND ((tblTransactions.CallCategory) In ('120','121','152','153','205','206','178','179','31','69','50','77','36','38','43','66','15','139','173','195','217','6','49','42','19','223','224','225','226','227','228','229','230','231','232')))
ORDER BY tblTransactions.LnNumber;
The Key for these 2 tables are LnId, UserId, and TransDate
I have accounted for the time difference with the following, but I am now being asked for the Date range twice. Is there a better way to accomplish this that won't ask me for my date range twice?
SELECT tblTransactions.LnNumber, tblTransactions.TransDate, tblCallCatValues.Level2, tblReRegTransactions.OldLoan, tblReRegTransactions.NewLoan, tblReRegTransactions.Reason
FROM (tblTransactions INNER JOIN tblCallCatValues ON tblTransactions.CallCategory = tblCallCatValues.CatValue) LEFT JOIN tblReRegTransactions ON (tblTransactions.LnNumber = tblReRegTransactions.LnId) AND (tblTransactions.PricerID = tblReRegTransactions.UserId) AND (datediff("s",tblTransactions.TransDate , tblReRegTransactions.TransDate) =1) OR (datediff("s",tblTransactions.TransDate , tblReRegTransactions.TransDate) =0)
WHERE (((tblTransactions.TransDate)>[StartDate] And (tblTransactions.TransDate)<[EndDateComp]) AND ((tblTransactions.CallCategory) In ('120','121','152','153','205','206','178','179','31','69','50','77','36','38','43','66','15','139','173','195','217','6','49','42','19','223','224','225','226','227','228','229','230','231','232')))
ORDER BY tblTransactions.LnNumber;