I have now searched quite a lot but maybe it's my english or can you point me to the correct post?
I have one table with ID and Date
001, 31.12.2011
002, 31.12.2011
002, 1.1.2012
003, 1.1.2012
Now I would like to run an union query based on a form [Old Date], [New Date] which returns a table (ID,Status)
001 Removed
002 BroughtFwd
003 New
I have the idea to do an union query which selects
SELECT All Old
UNION
SELECT All BroughtFwd
UNION
SELECT All New
The Form is easy, but I am not sure how to write the SQL. With EXIST?
Select *, Status As "Old"
FROM (SELECT * FROM Table WHERE Date=[OldDate]) WHERE
EXISTS (SELECT * FROM Table WHERE Date=[NewDate])
UNION
---
I fear this is not going to work and is much too complicated for what I want to accomplish.
I have one table with ID and Date
001, 31.12.2011
002, 31.12.2011
002, 1.1.2012
003, 1.1.2012
Now I would like to run an union query based on a form [Old Date], [New Date] which returns a table (ID,Status)
001 Removed
002 BroughtFwd
003 New
I have the idea to do an union query which selects
SELECT All Old
UNION
SELECT All BroughtFwd
UNION
SELECT All New
The Form is easy, but I am not sure how to write the SQL. With EXIST?
Select *, Status As "Old"
FROM (SELECT * FROM Table WHERE Date=[OldDate]) WHERE
EXISTS (SELECT * FROM Table WHERE Date=[NewDate])
UNION
---
I fear this is not going to work and is much too complicated for what I want to accomplish.