probably something simple

Qwerty8989

Registered User.
Local time
Today, 12:47
Joined
Oct 17, 2006
Messages
11
I am trying to create an IN query (ACCESS) which will firstly show the customers table (specific details) then the orders details should be in the IN query, I formulated this but it won't work:

SELECT s.CustomerID, Address, City, PostalCode
FROM Customers s
WHERE
s.OrderID IN
(SELECT s.OrderID FROM Orders p
WHERE s.OrderDate = '1996')
AND
s.OrderID IN
(SELECT s.OrderID FROM Orders p
WHERE s.OrderDate = '1997');

Here is the one I did to show the customers and orders who made orders in 1996 and 97:

SELECT Customers.CustomerID AS Customers_CustomerID, Orders.CustomerID AS Orders_CustomerID, Customers.Address, Customers.City, Customers.PostalCode, Orders.OrderID, Orders.OrderDate
FROM Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID
WHERE (((Orders.OrderDate) Between #1/1/1996# And #12/31/1997#));



it is probably something simple I am missing here! Sorry to keep asking :(
 
Try changing:

s.OrderID FROM Orders p

To

p.OrderID FROM Orders p

in both places

Just to let you know, this will give you customers who have placed orders in 1996 AND 1997 ... not OR ...
 

Users who are viewing this thread

Back
Top Bottom