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))
Between In (select AD from Admit_Date) and In (DC from Discharge_Date)

Is there a better way?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
This is incorrect SQL and would make not much sense. Cause IN () tests against a set..

I think you're looking for a MIN/MAX solution:


Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day 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;
joylene6Author Commented:
Thank you.  With this suggestion I was able to modify the query.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.