Solved

Access sql

Posted on 2014-09-29
4
559 Views
Last Modified: 2014-10-01
There are three tables – table specific to item, table specific to distributor and a join table that has existing combination of item and distributor. Usually use fill in the jon table to with the possible (existing combination of item and the distributor level where they are sold. I need a union query oof some sort that returns a Cartesian product of the two tables – items Distributor join table and distributor List table  - so that for example –
If item T23 was listed with only distributor D01 in the join table >> then the query returns a total of 5 rows – with the possible combination of that item and all the other distributor list but puts 0 for the price. See attached image and DB.
Thank you
superDB.accdb
superDB-QueryResults.jpg
0
Comment
Question by:Rayne
[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
  • 2
  • 2
4 Comments
 
LVL 38

Expert Comment

by:PatHartman
ID: 40351067
You don't need a Union.  A union query stacks lists on top of each other so all rows from tblA are returned followed by all rows from tblB.  Both tblA and tblB MUST have the same format.  A join compares two tables and returns matches (inner join), rows from tblA without rows in tblB (left join), rows from tblB without rows in tblA (right join), all rows from tblA matched to every row in tblB (cross join or Cartesian product).

So to create a Cartesian Product, add the two tables to the QBE.  Select the columns you want from each table.  Do NOT draw a join line.
0
 

Author Comment

by:Rayne
ID: 40351145
A and B have different formats because they are different tables
0
 

Author Comment

by:Rayne
ID: 40351147
so i cant change thier column order or numbers
0
 
LVL 38

Accepted Solution

by:
PatHartman earned 500 total points
ID: 40352201
I said you don't need a union so you don't need to worry about column format or order.  You need a query that creates a Cartesian Product.  Add both tables to the QBE.  Do NOT draw a join line.  Select the columns you want from either table.
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

632 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