G
Gary Walter
Hello group,
I just cannot think this morning!
I have a table that contains a "course history"
of books used for each Term in each course
of those Terms.
A simplified example might be the following:
tblControlInfo
ID Term ISBN Title Course
1 P03 1 in P03 only a
2 P03 1 in P03 only b
3 P03 2 in both terms c
4 P03 2 in both terms d
5 P04 3 in P04 only e
6 P04 3 in P04 only f
7 P04 2 in both terms g
8 P04 2 in both terms h
The same book might be used in separate courses
in the same Term, so an ISBN might occur more
than once in a Term.
Obviously, this is a simple example and there
are "years" of Terms in the table.
A user will fill a table "tblInTerm" through a
form with Terms where the user wants to return
*all the books common to the Terms entered*
in a report.
If tblInTerm were:
ID Term
1 P04
2 P03
they would want to see:
ID Term ISBN Title Course
3 P03 2 in both terms c
4 P03 2 in both terms d
7 P04 2 in both terms g
8 P04 2 in both terms h
tblInTerm could contain only one Term,
or it could contain *many* Terms.
Without asking me to normalize my data
(I know ....#$%@!&), is there a general,
single query that would handle all cases?
It looks to me like I will have to always
reconstruct a query, "grouping by ISBN
returning ISBN's where all Terms in tblInTerm
are in the group," then return all fields from
tblControlInfo joined with tblInTerm on
Term and joined to the group-by-query on ISBN.
Maybe I am missing some simple thing?
Thanks,
Gary Walter
I just cannot think this morning!
I have a table that contains a "course history"
of books used for each Term in each course
of those Terms.
A simplified example might be the following:
tblControlInfo
ID Term ISBN Title Course
1 P03 1 in P03 only a
2 P03 1 in P03 only b
3 P03 2 in both terms c
4 P03 2 in both terms d
5 P04 3 in P04 only e
6 P04 3 in P04 only f
7 P04 2 in both terms g
8 P04 2 in both terms h
The same book might be used in separate courses
in the same Term, so an ISBN might occur more
than once in a Term.
Obviously, this is a simple example and there
are "years" of Terms in the table.
A user will fill a table "tblInTerm" through a
form with Terms where the user wants to return
*all the books common to the Terms entered*
in a report.
If tblInTerm were:
ID Term
1 P04
2 P03
they would want to see:
ID Term ISBN Title Course
3 P03 2 in both terms c
4 P03 2 in both terms d
7 P04 2 in both terms g
8 P04 2 in both terms h
tblInTerm could contain only one Term,
or it could contain *many* Terms.
Without asking me to normalize my data
(I know ....#$%@!&), is there a general,
single query that would handle all cases?
It looks to me like I will have to always
reconstruct a query, "grouping by ISBN
returning ISBN's where all Terms in tblInTerm
are in the group," then return all fields from
tblControlInfo joined with tblInTerm on
Term and joined to the group-by-query on ISBN.
Maybe I am missing some simple thing?
Thanks,
Gary Walter