Solved

MS Access Nested Joins

Posted on 2010-08-31
3
305 Views
Last Modified: 2012-06-27
From the query below, I need to join another table, ZipCode, that joins to the Ozips table where Left(ZipCode.zip,3) = Ozips.Ozip. Could someone assist?

SELECT Perishible.Mode
, Ozips.Orgn
, Ozips.Ozip
, Perishible.[Origin State Prov]
, Perishible.[Destination Zone Code]
, Warehouse.Nbr
, Warehouse.Location_City
, Warehouse.State
, Warehouse.[3Digit]
FROM Warehouse
INNER JOIN (Dzips
INNER JOIN (Ozips
RIGHT JOIN Perishible
ON Ozips.Orgn = Perishible.[Origin Zone Code])
ON Dzips.Drgn = Perishible.[Destination Zone Code])
ON Warehouse.[3Digit] = Dzips.[3Digit]
GROUP BY Perishible.Mode
, Ozips.Orgn
, Ozips.Ozip
, Perishible.[Origin State Prov]
, Perishible.[Destination Zone Code]
, Warehouse.Nbr
, Warehouse.Location_City
, Warehouse.State
, Warehouse.[3Digit]

0
Comment
Question by:dchau12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 16

Accepted Solution

by:
carsRST earned 250 total points
ID: 33568225
SELECT Perishible.Mode
, Ozips.Orgn
, Ozips.Ozip
, Perishible.[Origin State Prov]
, Perishible.[Destination Zone Code]
, Warehouse.Nbr
, Warehouse.Location_City
, Warehouse.State
, Warehouse.[3Digit]
FROM Warehouse
INNER JOIN (Dzips
INNER JOIN (Ozips
RIGHT JOIN Perishible
ON Ozips.Orgn = Perishible.[Origin Zone Code])
ON Dzips.Drgn = Perishible.[Destination Zone Code])
ON Warehouse.[3Digit] = Dzips.[3Digit]

Inner join ZipCode z on
Left(z.zip,3) = Ozips.Ozip
GROUP BY Perishible.Mode
, Ozips.Orgn
, Ozips.Ozip
, Perishible.[Origin State Prov]
, Perishible.[Destination Zone Code]
, Warehouse.Nbr
, Warehouse.Location_City
, Warehouse.State
, Warehouse.[3Digit]
0
 

Author Comment

by:dchau12
ID: 33568682
Appreciate the quick response.

There's a missing operater here:

Warehouse.[3Digit] = Dzips.[3Digit]
Inner join ZipCode z on
Left(z.zip,3) = Ozips.Ozip

Should there be a set of parenthesis somewhere?

I tried moving the INNER JOIN on ZipCode to be nested in Ozips, but to no success.
0
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 250 total points
ID: 33569192
Why not do it in the Access query grid? You will get all the ( ) you need then.
0

Featured Post

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Query help 3 39
sql update 2 46
Changing the Schema for all Tables in a Tables - MS SQL Server 2008 R2. 3 52
Estimating my database size 7 51
Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question