Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MS Access Nested Joins

Posted on 2010-08-31
3
Medium Priority
?
320 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 1000 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 1000 total points
ID: 33569192
Why not do it in the Access query grid? You will get all the ( ) you need then.
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

715 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