Pulling data from 2 tables and getting duplicates

  • Thread starter Thread starter NewAccessDude
  • Start date Start date
N

NewAccessDude

Hello,

I am using Access more or less to do all the manual sorting for me. I have 3
tables, (A) with the base information and the other (B&C) with extra info
that I need to pull. My query should be pulling everything from table A and
the bits of info from tables B and C that match up with a container field in
table A. If you are not completed confused yet, here is my SQL:

SELECT tblONDOCK.Field1, tblLFDREPORT.[Port LFD], tblLFDREPORT.[Yard
Location], tblONDOCK.[Rail Event], tblONDOCK.Date, tblLFDREPORT.Customs,
tblLFDREPORT.Constraints, tblLFDREPORT.[Train ID], tblONDOCK.Tracking,
tblONDOCK.[B/L #], tblONDOCK.Container, tblONDOCK.[Size/Type], tblONDOCK.[Alt
Imp Base], tblONDOCK.Delivery, tblONDOCK.[Delivery City], tblONDOCK.[Move
Terms], tblONDOCK.Consignee, tblONDOCK.[Net Weight (Lbs)], tblONDOCK.[B/L
Piece Ct], tblONDOCK.Route, tblONDOCK.Hazard, tblONDOCK.[Sort Group]
FROM (tblLFDREPORT LEFT JOIN tblONDOCK ON tblLFDREPORT.Container =
tblONDOCK.Container) LEFT JOIN tblFULLREPORT ON tblONDOCK.Container =
tblFULLREPORT.Equipment
WHERE (((tblONDOCK.Field1) Is Not Null));

Table OnDock is the base table, and container is the string that links all
three tables. Table Full Report has bits of info I need as well as table
LFDReport.

Any and all help is appreciated,

Thanks!
 
well if you are getting duplicates it means in the second table there
are multiple records belonging to table 1 to resolve the duplicates in
your query just add distinct to it eg SELECT DISTINCT and if that
dosnt work try SELECT DISTINCT ROW if neither of thoes work post some
sample data of what the query is returning so i can have a look
 
Thanks for the help, this particular database was scrapped but I am tinkering
with it when I get the time. I'll let you know if you solution works out
 
Back
Top