|
Home > Archive > MS Access database support > April 2006 > Filtering In A Query
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Filtering In A Query
|
|
| Sheldon 2006-04-06, 8:29 pm |
| I have a select query (Query1) that, when run, could have either a 1,
2, 3, 4, 5, 6, 7 or 8 in one field (Field1). I then have a follow-on
query (Query2) whose source is Query1 and one other table (Table1)
which is a one record table. What I'm trying to do in Query2 is look
at a field (Field2) in Table1. If Field2 equals 1, 3, 5, or 7, then
only display records from Query1 where Field1 = Field2. If Field2
equals 2, 4, 6 or 8, do nothing. I can't seem to get this to work and
would appreciate any suggestions/help.
Thank you,
Sheldon Potolsky
| |
| MGFoster 2006-04-06, 8:29 pm |
| Sheldon wrote:
> I have a select query (Query1) that, when run, could have either a 1,
> 2, 3, 4, 5, 6, 7 or 8 in one field (Field1). I then have a follow-on
> query (Query2) whose source is Query1 and one other table (Table1)
> which is a one record table. What I'm trying to do in Query2 is look
> at a field (Field2) in Table1. If Field2 equals 1, 3, 5, or 7, then
> only display records from Query1 where Field1 = Field2. If Field2
> equals 2, 4, 6 or 8, do nothing. I can't seem to get this to work and
> would appreciate any suggestions/help.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Try:
SELECT query1.*
FROM table1 INNER JOIN query1 ON table1.field2 = query1.field1
WHERE table1.field2 IN (1,3,5,7)
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/ AwUBRDWEG4echKqOuFEg
EQIO+QCg1qMo8lBgm6tZ
1q7/bPXixTKAkYoAoPcs
9+jC1CVoLDmFq4Xqjk65
2Lhi
=ECqt
-----END PGP SIGNATURE-----
| |
| Sheldon 2006-04-07, 1:31 pm |
| In rereading my original post, I realize that I was not clear one one
point. If Field2
equals 2, 4, 6 or 8, I WANT TO SHOW ALL RECORDS THAT HAVE ANY OF THOSE
VALUES.
Sheldon Potolsky
|
|
|
|
|