Query subordinate

cimabue

Registered User.
Local time
Yesterday, 20:54
Joined
Feb 24, 2012
Messages
11
Good morning everyone. Working with access 2003 and I have a problem with subordinate queries. Using a command button to open a report that displays only the dates of a particular product that has no orders.
The structure has two tables. The first table (called: 2011) with fields (Prodotto) and (date) order.
The second table (called: Confronto) with field (Data) which stores all dates in sequence from the beginning of 2011 to 2012
Two queries (Annuale and date).
The first query (Annuale) selects all the orders placed during the year based on the product chosen and the date of the order:
SELECT [2011].Prodotto, [2011].Data
FROM 2011
WHERE ((([2011].Prodotto)=[insert product]));
The second query (date) compares the result of first query (Annuale) with the table of “date” and extracts only the date without the orders of that product:
SELECT Confronto.Data
FROM [Confronto] LEFT JOIN Annuale ON Confronto.Data = Annuale.Data
WHERE (((Confronto.Data) Between [insert initial date] And [insert end date]) AND ((Annuale.Data) Is Null));

I need to merge two queries in a single SQL statement. Can anyone help me?
thanks
 
Howzit

Try

Code:
SELECT Confronto.Data
FROM [Confronto] LEFT JOIN 
(SELECT [2011].Prodotto, [2011].Data FROM 2011
WHERE ((([2011].Prodotto)=[insert product]))) AS T1
 ON Confronto.Data = T1.Data
WHERE (((Confronto.Data) Between [insert initial date] And [insert end date]) AND ((T1.Data) Is Null));
 
Thanks,
your solution is good
Sergio
 

Users who are viewing this thread

Back
Top Bottom