Link to home
Start Free TrialLog in
Avatar of joylene6
joylene6Flag for United States of America

asked on

Question of combining two IN SELECT statements to make a between statement

Hello-   I am using a IN SELECT statement  to add a date to my query in MSACCESS,  In (select AD from Admit_Date). Where AD is a field from the local table Admit_Date.

I want to call a date range from two local tables  the two statements I have is  In (select AD from Admit_Date)   and

I tried something like these, but it does not  seem to work:

Between (In (select AD from Admit_Date) and (In (DC from Discharge_Date))
or
Between In (select AD from Admit_Date) and In (DC from Discharge_Date)
 

Is there a better way?
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It would have been more helpful if you had pasted the current SQL  As it is, I can't even tell if you actually need the subselect or should be using a join.  Also, to avoid turning this into an all day affair, please post the schema for the two tables and how they are related if it isn't obvious from column names.

The syntax for a Between clause is:

Select ...
From  YourFirstTable
Where YourDate Between Admit_Date and Discharge_Date;
Avatar of joylene6

ASKER

Thank you.  With this suggestion I was able to modify the query.