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

SQL query

P: n/a
Jon
Hi all

Got a tricky SQL query.
One table

tblTemp
ID - Factory - Articlenr
1 - 22 - CP001
2 - 35 - CP001
3 - 35 - CS001
4 - 35 - BA001
5 - 23 - CP001
6 - 35 - CS001
7 - 22 - CP001

I need to select all from Factory 35
And in that query all Articlenr that start with CP or CS

The query would show
ID - Factory - Articlenr
2 - 35 - CP001
3 - 35 - CS001
6 - 35 - CS001
Any pointers would be most appreciative

Regards
Jon

jr*@telia.com

Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Jon

Select the 3 fields you require from the table in the query grid and do the
following in the criteria:
Under the Factory type 35
Under the Articlenr type Like "CP*" Or Like "CS*"

If you look at the SQL part of the query it should read:
SELECT ID, Factory, Articlenr
FROM tblTemp
WHERE (((tblTemp.Factory)=35) AND ((tblTemp.Articlenr) Like "CP*" Or
(tblTemp.Articlenr) Like "CS*"));

Stewart
"Jon" <jr*@telia.com> wrote in message
news:aH*******************@newsc.telia.net...
Hi all

Got a tricky SQL query.
One table

tblTemp
ID - Factory - Articlenr
1 - 22 - CP001
2 - 35 - CP001
3 - 35 - CS001
4 - 35 - BA001
5 - 23 - CP001
6 - 35 - CS001
7 - 22 - CP001

I need to select all from Factory 35
And in that query all Articlenr that start with CP or CS

The query would show
ID - Factory - Articlenr
2 - 35 - CP001
3 - 35 - CS001
6 - 35 - CS001
Any pointers would be most appreciative

Regards
Jon

jr*@telia.com

Nov 12 '05 #2

P: n/a
Jon
Thanks Stewart

Works like a charm

Jon
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.