By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,847 Members | 3,102 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,847 IT Pros & Developers. It's quick & easy.

Criteria based on a select statement

P: n/a
Hello,
Is it possible, in Access, to base the criteria of a query on another
query. Here's an example of what I mean:

SELECT ORDER_NO, DESC, TYPE, NAME
FROM [Cutting List]
WHERE ((([Cutting List].[ORDER_ NO])= SELECT JobID from jobs where code
= 20846));

In otherwords, the order number in the Cutting list table is the jobid
from the jobs table where the code = 20846.

This is possible in SQL Server isn't it? Or did I dream it?

Thanks for any help

Colin

Dec 20 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Bobby" <bo****@blueyonder.co.ukwrote in message
news:11**********************@t46g2000cwa.googlegr oups.com...
Hello,
Is it possible, in Access, to base the criteria of a query on another
query. Here's an example of what I mean:

SELECT ORDER_NO, DESC, TYPE, NAME
FROM [Cutting List]
WHERE ((([Cutting List].[ORDER_ NO])= SELECT JobID from jobs where code
= 20846));

In otherwords, the order number in the Cutting list table is the jobid
from the jobs table where the code = 20846.

This is possible in SQL Server isn't it? Or did I dream it?
Try...

SELECT ORDER_NO, DESC, TYPE, NAME
FROM [Cutting List]
WHERE [Cutting List].[ORDER_ NO] = (SELECT JobID from jobs where code = 20846)

or

SELECT ORDER_NO, DESC, TYPE, NAME
FROM [Cutting List]
WHERE [Cutting List].[ORDER_ NO] In(SELECT JobID from jobs where code = 20846)
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Dec 20 '06 #2

P: n/a

Rick Brandt wrote:
Try...

SELECT ORDER_NO, DESC, TYPE, NAME
FROM [Cutting List]
WHERE [Cutting List].[ORDER_ NO] = (SELECT JobID from jobs where code = 20846)

or

SELECT ORDER_NO, DESC, TYPE, NAME
FROM [Cutting List]
WHERE [Cutting List].[ORDER_ NO] In(SELECT JobID from jobs where code = 20846)
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Thanks again Rick,

Colin

Dec 20 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.