I have the following SQL statement and there may be multiple records for a TrackingNumber. The TrackingNumber and the DeliveryDate (which has a time stamp in it) make up the unique key. I need to look at the most recent DeliveryDate and then check the criteria, but I'm not sure how to do this.
TIA!!!
SELECT dbo_vw_Stor_Del_2.TrackingNumber, dbo_vw_Stor_Del_2.InboundDate, dbo_vw_Stor_Del_2.InboundUser, dbo_vw_Stor_Del_2.DeliveryDate, dbo_vw_Stor_Del_2.ScannedBy, dbo_vw_Stor_Del_2.Recipient, dbo_vw_Stor_Del_2.Signature, dbo_vw_Stor_Del_2.Carrier, dbo_vw_Stor_Del_2.FirstStop, dbo_vw_Stor_Del_2.InboundComments, dbo_vw_Stor_Del_2.DeliveryBldg, dbo_vw_Stor_Del_2.DeliveryComments, [Enter Date as mm/dd/yyyy] AS Inbound
FROM dbo_vw_Stor_Del_2
WHERE (((dbo_vw_Stor_Del_2.Recipient) Is Null) AND ((dbo_vw_Stor_Del_2.Signature) Is Null) AND ((Format([dbo_vw_Stor_Del_2.InboundDate],'mm/dd/yyyy'))=[Enter Date as mm/dd/yyyy])) OR (((dbo_vw_Stor_Del_2.Signature) Is Null) AND ((Format([dbo_vw_Stor_Del_2.InboundDate],'mm/dd/yyyy'))=[Enter Date as mm/dd/yyyy]) AND ((UCase([Recipient])) Not In ("DRIVER RELEASE","HARD COPY SIGNATURE")))
ORDER BY FirstStop;
By the way, this is an Access link to SQL Server therefore all the parens!
TIA!!!
SELECT dbo_vw_Stor_Del_2.TrackingNumber, dbo_vw_Stor_Del_2.InboundDate, dbo_vw_Stor_Del_2.InboundUser, dbo_vw_Stor_Del_2.DeliveryDate, dbo_vw_Stor_Del_2.ScannedBy, dbo_vw_Stor_Del_2.Recipient, dbo_vw_Stor_Del_2.Signature, dbo_vw_Stor_Del_2.Carrier, dbo_vw_Stor_Del_2.FirstStop, dbo_vw_Stor_Del_2.InboundComments, dbo_vw_Stor_Del_2.DeliveryBldg, dbo_vw_Stor_Del_2.DeliveryComments, [Enter Date as mm/dd/yyyy] AS Inbound
FROM dbo_vw_Stor_Del_2
WHERE (((dbo_vw_Stor_Del_2.Recipient) Is Null) AND ((dbo_vw_Stor_Del_2.Signature) Is Null) AND ((Format([dbo_vw_Stor_Del_2.InboundDate],'mm/dd/yyyy'))=[Enter Date as mm/dd/yyyy])) OR (((dbo_vw_Stor_Del_2.Signature) Is Null) AND ((Format([dbo_vw_Stor_Del_2.InboundDate],'mm/dd/yyyy'))=[Enter Date as mm/dd/yyyy]) AND ((UCase([Recipient])) Not In ("DRIVER RELEASE","HARD COPY SIGNATURE")))
ORDER BY FirstStop;
By the way, this is an Access link to SQL Server therefore all the parens!