joining 4 tables

  • Thread starter Thread starter unslunghero
  • Start date Start date
U

unslunghero

Guest
Hi:
I'm using an access db backend for a .asp webpage, and I'm having trouble joining 4 tables in such a way as to make the results "page" in asp. This is a SQL-type question that I hope you can assist me with.

Here are the contents of my db:
Client: Orders: OrderDetails: Products
ClientID OrderID OrderDetailID ProductID
other fields ClientID OrderID other fields
other fields ProductID
other fields

I've got a 1:many relationship between Client and Orders, and between Orders and OrderDetails. Basically, every client can have multiple orders; ever order contains multiple details, and table 4 is a lookup table.

I've had success joining the first two and the second two tables together, but when I try to join all 4, I have no luck. The 2 SQL stmts look like this:

Select * FROM Client, Orders WHERE Client.ClientID = Orders.ClientID AND OrderDate like '9/14/02' ORDER BY OrderID

Select * from OrderDetails, Products WHERE OrderDetails.ProductID = Products.ProductID ORDER BY OrderID

Then, I loop through the results of the first query, matching them with results in the second query, where I also loop until I've displayed all of the matching order details.

I need help! All assistance appreciated!
UsH
 

Users who are viewing this thread

Back
Top Bottom