You can't start a SQL query with an IIF statement?
No, you cannot start a query with any function reference.
Can you write and save the first query then reference this in the second query in design view
What if it returns no records?
The OP reads like the db is not normalized; or is there another reason why you'd find similar records in more than one table (aside from being in separate db's?).
Anyway, even if "idnumber could be in either or both with the same age - use a union query" I suspect a union query alone would suffice - just don't use the "All" keyword.
I think if you have this
tblA |
|
|
tblB |
|
ID |
Age |
|
ID |
Age |
100 |
10 |
|
100 |
40 |
100 |
20 |
|
|
|
100 |
30 |
|
|
|
100 |
40 |
|
|
|
that this
SELECT ID, Age from tblA WHERE ID = 100
UNION
SELECT ID, Age from tblB WHERE ID = 100
will give you this
ID |
Age |
100 |
10 |
100 |
20 |
100 |
30 |
100 |
40 |
without getting two records for 100 / 40. If you use the All keyword, you will get 2 records for 100 / 40.
Last edited by Micron; 09-06-2016 at 10:22 PM.
Reason: clarification
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.