This question has been asked may times before but after reading the threads, I cannot seem to find a solution:
I've got a query that contains three tables (inner joined), while i get the results I'm searching for, I often get duplicate records.
Here is the SQL for the query in question:
SELECT LOI_Crew.Id, LOI_Crew.Idd, LOI_Crew.Name, LOI_Crew.Surname, LOI_Crew.Rank, LOI_Crew.Nationality, LOI_Crew.POB, LOI_Crew.DOB, LOI_Crew.Passport, LOI_Crew.Date_Issue_PP, LOI_Crew.Date_Expiry_PP, LOI_Crew.SBook, LOI_Crew.Date_Issue_SB, LOI_Crew.Date_Expiry_SB, LOI_Crew.Time_Onboard, LOI_Crew.Delete, LOI_Crew.Pasado_Policia, LOI_Data.VesselName, LOI_Data.Voy, LOI_Data.Bandera, LOI_Data.IMO, LOI_Data.Procedencia, LOI_Data.Destino, LOI_Data.Arrival_Date, LOI_Data.Arrival_Time, LOI_Data.Dept_Date, LOI_Data.Dept_Time, LOI_Data.[Embassy/Consulate], LOI_Data.Embassy_Fax, LOI_Data.Embassy_Email, LOI_Data.Automovil, LOI_Data.Tren, LOI_Data.Avion, LOI_Data.Enrolamiento, LOI_Data.Transferencia, LOI_Data.Fin_Contrato, LOI_Data.Crewing_Office, LOI_Data.Crewing_Tel, LOI_Data.Crewing_Email, LOI_Data.[1_Aeropuerto_Salida], LOI_Data.[1_Aeropuerto_Llegada], LOI_Data.[1_Salida_Date], LOI_Data.[1_Salida_Time], LOI_Data.[1_Llegada_Date], LOI_Data.[1_Llegada_Time], LOI_Data.[1_Numero_Vuelo], LOI_Data.[2_Aeropuerto_Salida], LOI_Data.[2_Salida_Date], LOI_Data.[2_Salida_Time], LOI_Data.[2_Llegada_Date], LOI_Data.[2_Llegada_Time], LOI_Data.[2_Numero_Vuelo], LOI_Data.[3_Aeropuerto_Salida], LOI_Data.[3_Aeropuerto_Llegada], LOI_Data.[3_Salida_Date], LOI_Data.[3_Salida_Time], LOI_Data.[3_Llegada_Date], LOI_Data.[3_Llegada_Time], LOI_Data.[3_Numero_Vuelo], LOI_Data.[4_Aeropuerto_Salida], LOI_Data.[4_Aeropuerto_Llegada], LOI_Data.[4_Salida_Date], LOI_Data.[4_Salida_Time], LOI_Data.[4_Llegada_Time], LOI_Data.[4_Numero_Vuelo], LOI_Data.[5_Aeropuerto_Salida], LOI_Data.[5_Aeropuerto_Llegada], LOI_Data.[5_Salida_Date], LOI_Data.[5_Salida_Time], LOI_Data.[5_Llegada_Date], LOI_Data.[5_Numero_Vuelo], LOI_Data.Aeropuerto_Entrada_Esp, LOI_Data.Fecha_Entrada_Esp, LOI_Data.Puerto_Embarque, LOI_Data.Comentarios, LOI_Data.Extra_Details, LOI_Data.[2_Aeropuerto_Llegada], LOI_Data.[5_Llegada_Time], LOI_Data.Code_Id, LOI_Crew.SDate, LOI_Crew.Code_Id, Taxi_Date_Search.WOrder, Taxi_Date_Search.Voa
FROM (LOI_Data LEFT JOIN LOI_Crew ON LOI_Data.Idd = LOI_Crew.Idd) INNER JOIN Taxi_Date_Search ON LOI_Data.Code_Id = Taxi_Date_Search.Id
WHERE ((Not (LOI_Crew.SDate) Is Null) AND ((Taxi_Date_Search.Voa)=True));
Can someone tell me the best way to hide the duplicate from my query once it's run.
Thanks for all,
I've got a query that contains three tables (inner joined), while i get the results I'm searching for, I often get duplicate records.
Here is the SQL for the query in question:
SELECT LOI_Crew.Id, LOI_Crew.Idd, LOI_Crew.Name, LOI_Crew.Surname, LOI_Crew.Rank, LOI_Crew.Nationality, LOI_Crew.POB, LOI_Crew.DOB, LOI_Crew.Passport, LOI_Crew.Date_Issue_PP, LOI_Crew.Date_Expiry_PP, LOI_Crew.SBook, LOI_Crew.Date_Issue_SB, LOI_Crew.Date_Expiry_SB, LOI_Crew.Time_Onboard, LOI_Crew.Delete, LOI_Crew.Pasado_Policia, LOI_Data.VesselName, LOI_Data.Voy, LOI_Data.Bandera, LOI_Data.IMO, LOI_Data.Procedencia, LOI_Data.Destino, LOI_Data.Arrival_Date, LOI_Data.Arrival_Time, LOI_Data.Dept_Date, LOI_Data.Dept_Time, LOI_Data.[Embassy/Consulate], LOI_Data.Embassy_Fax, LOI_Data.Embassy_Email, LOI_Data.Automovil, LOI_Data.Tren, LOI_Data.Avion, LOI_Data.Enrolamiento, LOI_Data.Transferencia, LOI_Data.Fin_Contrato, LOI_Data.Crewing_Office, LOI_Data.Crewing_Tel, LOI_Data.Crewing_Email, LOI_Data.[1_Aeropuerto_Salida], LOI_Data.[1_Aeropuerto_Llegada], LOI_Data.[1_Salida_Date], LOI_Data.[1_Salida_Time], LOI_Data.[1_Llegada_Date], LOI_Data.[1_Llegada_Time], LOI_Data.[1_Numero_Vuelo], LOI_Data.[2_Aeropuerto_Salida], LOI_Data.[2_Salida_Date], LOI_Data.[2_Salida_Time], LOI_Data.[2_Llegada_Date], LOI_Data.[2_Llegada_Time], LOI_Data.[2_Numero_Vuelo], LOI_Data.[3_Aeropuerto_Salida], LOI_Data.[3_Aeropuerto_Llegada], LOI_Data.[3_Salida_Date], LOI_Data.[3_Salida_Time], LOI_Data.[3_Llegada_Date], LOI_Data.[3_Llegada_Time], LOI_Data.[3_Numero_Vuelo], LOI_Data.[4_Aeropuerto_Salida], LOI_Data.[4_Aeropuerto_Llegada], LOI_Data.[4_Salida_Date], LOI_Data.[4_Salida_Time], LOI_Data.[4_Llegada_Time], LOI_Data.[4_Numero_Vuelo], LOI_Data.[5_Aeropuerto_Salida], LOI_Data.[5_Aeropuerto_Llegada], LOI_Data.[5_Salida_Date], LOI_Data.[5_Salida_Time], LOI_Data.[5_Llegada_Date], LOI_Data.[5_Numero_Vuelo], LOI_Data.Aeropuerto_Entrada_Esp, LOI_Data.Fecha_Entrada_Esp, LOI_Data.Puerto_Embarque, LOI_Data.Comentarios, LOI_Data.Extra_Details, LOI_Data.[2_Aeropuerto_Llegada], LOI_Data.[5_Llegada_Time], LOI_Data.Code_Id, LOI_Crew.SDate, LOI_Crew.Code_Id, Taxi_Date_Search.WOrder, Taxi_Date_Search.Voa
FROM (LOI_Data LEFT JOIN LOI_Crew ON LOI_Data.Idd = LOI_Crew.Idd) INNER JOIN Taxi_Date_Search ON LOI_Data.Code_Id = Taxi_Date_Search.Id
WHERE ((Not (LOI_Crew.SDate) Is Null) AND ((Taxi_Date_Search.Voa)=True));
Can someone tell me the best way to hide the duplicate from my query once it's run.
Thanks for all,