J
Juan Melero
I have the same problem as one of the problems stated
earlier with the most recent date. The only problem is
that I need to Join Three tables and I think this is
giving me a problem.
This is what I have so far.
SELECT tbl_delivery_info.Dest_Unit, locn.Dest_City,
locn.Dest_St, tbl_delivery_info.Shipper,
tbl_delivery_info.Del_Su_S, tbl_delivery_info.Del_Typ_Su,
tbl_delivery_info.Del_Su_E, tbl_delivery_info.Del_Mo_S,
tbl_delivery_info.Del_Typ_Mo, tbl_delivery_info.Del_Mo_E,
tbl_delivery_info.Del_Tu_S, tbl_delivery_info.Del_Typ_Tu,
tbl_delivery_info.Del_Tu_E, tbl_delivery_info.Del_We_S,
tbl_delivery_info.Del_Typ_We, tbl_delivery_info.Del_We_E,
tbl_delivery_info.Del_Th_S, tbl_delivery_info.Del_Typ_Th,
tbl_delivery_info.Del_Th_E, tbl_delivery_info.Del_Fr_S,
tbl_delivery_info.Del_Typ_Fr, tbl_delivery_info.Del_Fr_E,
tbl_delivery_info.Del_Sa_S, tbl_delivery_info.Del_Typ_Sa,
tbl_delivery_info.Del_Sa_E, locn.District,
locn.Store_Type, tbl_delivery_info.Live_Drop,
shippers.ship_type, tbl_delivery_info.Comments,
tbl_delivery_info.Recv_Alt_Ship,
tbl_delivery_info.XC_Dest_Unit,
tbl_delivery_info.XC_Ship_Unit,
tbl_delivery_info.Batch_Number,
tbl_delivery_info.Service_Level, Max
(tbl_delivery_info.Eff_Date) AS MaxOfEff_Date,
tbl_locn_profiles.closed_date, tbl_delivery_info.End_Date
FROM (shippers INNER JOIN (locn INNER JOIN
tbl_delivery_info ON locn.Dest_Unit =
tbl_delivery_info.Dest_Unit) ON shippers.SHIPPER =
tbl_delivery_info.Shipper) INNER JOIN tbl_locn_profiles ON
tbl_delivery_info.Dest_Unit = tbl_locn_profiles.Dest_Unit
GROUP BY tbl_delivery_info.Dest_Unit, locn.Dest_City,
locn.Dest_St, tbl_delivery_info.Shipper,
tbl_delivery_info.Del_Su_S, tbl_delivery_info.Del_Typ_Su,
tbl_delivery_info.Del_Su_E, tbl_delivery_info.Del_Mo_S,
tbl_delivery_info.Del_Typ_Mo, tbl_delivery_info.Del_Mo_E,
tbl_delivery_info.Del_Tu_S, tbl_delivery_info.Del_Typ_Tu,
tbl_delivery_info.Del_Tu_E, tbl_delivery_info.Del_We_S,
tbl_delivery_info.Del_Typ_We, tbl_delivery_info.Del_We_E,
tbl_delivery_info.Del_Th_S, tbl_delivery_info.Del_Typ_Th,
tbl_delivery_info.Del_Th_E, tbl_delivery_info.Del_Fr_S,
tbl_delivery_info.Del_Typ_Fr, tbl_delivery_info.Del_Fr_E,
tbl_delivery_info.Del_Sa_S, tbl_delivery_info.Del_Typ_Sa,
tbl_delivery_info.Del_Sa_E, locn.District,
locn.Store_Type, tbl_delivery_info.Live_Drop,
shippers.ship_type, tbl_delivery_info.Comments,
tbl_delivery_info.Recv_Alt_Ship,
tbl_delivery_info.XC_Dest_Unit,
tbl_delivery_info.XC_Ship_Unit,
tbl_delivery_info.Batch_Number,
tbl_delivery_info.Service_Level,
tbl_locn_profiles.closed_date, tbl_delivery_info.End_Date
HAVING (((locn.District)=[Enter District Number]) AND
((tbl_delivery_info.Service_Level)="1") AND
((tbl_locn_profiles.closed_date) Is Null) AND
((tbl_delivery_info.End_Date) Is Null Or
(tbl_delivery_info.End_Date)>Now()))
ORDER BY tbl_delivery_info.Dest_Unit,
tbl_delivery_info.Shipper;
This query still gives me two dates. I only need the most
recent date.
Can anybody tell me what I am doing wrong? I need your
help A.S.A.P. Thanks in advance.
earlier with the most recent date. The only problem is
that I need to Join Three tables and I think this is
giving me a problem.
This is what I have so far.
SELECT tbl_delivery_info.Dest_Unit, locn.Dest_City,
locn.Dest_St, tbl_delivery_info.Shipper,
tbl_delivery_info.Del_Su_S, tbl_delivery_info.Del_Typ_Su,
tbl_delivery_info.Del_Su_E, tbl_delivery_info.Del_Mo_S,
tbl_delivery_info.Del_Typ_Mo, tbl_delivery_info.Del_Mo_E,
tbl_delivery_info.Del_Tu_S, tbl_delivery_info.Del_Typ_Tu,
tbl_delivery_info.Del_Tu_E, tbl_delivery_info.Del_We_S,
tbl_delivery_info.Del_Typ_We, tbl_delivery_info.Del_We_E,
tbl_delivery_info.Del_Th_S, tbl_delivery_info.Del_Typ_Th,
tbl_delivery_info.Del_Th_E, tbl_delivery_info.Del_Fr_S,
tbl_delivery_info.Del_Typ_Fr, tbl_delivery_info.Del_Fr_E,
tbl_delivery_info.Del_Sa_S, tbl_delivery_info.Del_Typ_Sa,
tbl_delivery_info.Del_Sa_E, locn.District,
locn.Store_Type, tbl_delivery_info.Live_Drop,
shippers.ship_type, tbl_delivery_info.Comments,
tbl_delivery_info.Recv_Alt_Ship,
tbl_delivery_info.XC_Dest_Unit,
tbl_delivery_info.XC_Ship_Unit,
tbl_delivery_info.Batch_Number,
tbl_delivery_info.Service_Level, Max
(tbl_delivery_info.Eff_Date) AS MaxOfEff_Date,
tbl_locn_profiles.closed_date, tbl_delivery_info.End_Date
FROM (shippers INNER JOIN (locn INNER JOIN
tbl_delivery_info ON locn.Dest_Unit =
tbl_delivery_info.Dest_Unit) ON shippers.SHIPPER =
tbl_delivery_info.Shipper) INNER JOIN tbl_locn_profiles ON
tbl_delivery_info.Dest_Unit = tbl_locn_profiles.Dest_Unit
GROUP BY tbl_delivery_info.Dest_Unit, locn.Dest_City,
locn.Dest_St, tbl_delivery_info.Shipper,
tbl_delivery_info.Del_Su_S, tbl_delivery_info.Del_Typ_Su,
tbl_delivery_info.Del_Su_E, tbl_delivery_info.Del_Mo_S,
tbl_delivery_info.Del_Typ_Mo, tbl_delivery_info.Del_Mo_E,
tbl_delivery_info.Del_Tu_S, tbl_delivery_info.Del_Typ_Tu,
tbl_delivery_info.Del_Tu_E, tbl_delivery_info.Del_We_S,
tbl_delivery_info.Del_Typ_We, tbl_delivery_info.Del_We_E,
tbl_delivery_info.Del_Th_S, tbl_delivery_info.Del_Typ_Th,
tbl_delivery_info.Del_Th_E, tbl_delivery_info.Del_Fr_S,
tbl_delivery_info.Del_Typ_Fr, tbl_delivery_info.Del_Fr_E,
tbl_delivery_info.Del_Sa_S, tbl_delivery_info.Del_Typ_Sa,
tbl_delivery_info.Del_Sa_E, locn.District,
locn.Store_Type, tbl_delivery_info.Live_Drop,
shippers.ship_type, tbl_delivery_info.Comments,
tbl_delivery_info.Recv_Alt_Ship,
tbl_delivery_info.XC_Dest_Unit,
tbl_delivery_info.XC_Ship_Unit,
tbl_delivery_info.Batch_Number,
tbl_delivery_info.Service_Level,
tbl_locn_profiles.closed_date, tbl_delivery_info.End_Date
HAVING (((locn.District)=[Enter District Number]) AND
((tbl_delivery_info.Service_Level)="1") AND
((tbl_locn_profiles.closed_date) Is Null) AND
((tbl_delivery_info.End_Date) Is Null Or
(tbl_delivery_info.End_Date)>Now()))
ORDER BY tbl_delivery_info.Dest_Unit,
tbl_delivery_info.Shipper;
This query still gives me two dates. I only need the most
recent date.
Can anybody tell me what I am doing wrong? I need your
help A.S.A.P. Thanks in advance.