Hello,
I've been working on this for awhile, and can't figure out how to do it. I have 2 tables, and I'll simplify it by only including a few fields in each.
tblIssued
Name From To
AA 1 20
BB 40 70
CC 100 125
DD 200 250
__________________________
tblUsed
TransID CodeNum
11 18
12 15
13 123
14 43
15 111
16 66
17 42
18 68
19 57
20 212
21 6
In the tblUsed table, the transID field does not matter - the only field that we need to use is the CodeNum field.
What I would like to do is to combine the 2 tables in a query that can return the count of records for each Name, where CodeNum is within the range between From and To values in the tblIssued table.
For example, these are the counts that would be returned, given the CodeNums:
AA 3 (between 1 and 20)
BB 5 (between 40 and 70)
CC 2 (between 100 and 125)
DD 1 (between 200 and 250)
I'm not sure how to link the 2 tables, because one table has an exact number, and the other includes a range of numbers. I've seen examples of using aliases, and IN clauses, but don't understand those too well. If someone could help point me in the right direction, I would appreciate it.
Thanks in advance!
I've been working on this for awhile, and can't figure out how to do it. I have 2 tables, and I'll simplify it by only including a few fields in each.
tblIssued
Name From To
AA 1 20
BB 40 70
CC 100 125
DD 200 250
__________________________
tblUsed
TransID CodeNum
11 18
12 15
13 123
14 43
15 111
16 66
17 42
18 68
19 57
20 212
21 6
In the tblUsed table, the transID field does not matter - the only field that we need to use is the CodeNum field.
What I would like to do is to combine the 2 tables in a query that can return the count of records for each Name, where CodeNum is within the range between From and To values in the tblIssued table.
For example, these are the counts that would be returned, given the CodeNums:
AA 3 (between 1 and 20)
BB 5 (between 40 and 70)
CC 2 (between 100 and 125)
DD 1 (between 200 and 250)
I'm not sure how to link the 2 tables, because one table has an exact number, and the other includes a range of numbers. I've seen examples of using aliases, and IN clauses, but don't understand those too well. If someone could help point me in the right direction, I would appreciate it.
Thanks in advance!