H
Hexman
Hi All,
Here's my situation. I have two tables. Table1 is a 'transaction'
table. Table2 is a 'master' table. What I want to do is two-fold.
First I want to check if there is a match between ProdGrp (t1ProdGrp =
t2ProdGrp). If there isn't a match, indicate on the transaction there
is a critical error.
If there is a match, check to see if there is a complete match
(t1ProdGrp = t2ProdGrp AND t1Cat = t2Cat AND t1subCat = t2SubCat). If
there is a full match flag the transaction as valid. If not a full
match, indicate on the transaction there is a minor (correctable)
error.
My original thought was to create 2 select statements and do 2 queries
against Table2.
"Select * from Table2 where t1ProdGrp = t2ProdGroup "
"Select * from Table2 where t1ProdGrp = t2ProdGroup AND _
t1Cat = t2Cat AND t1subCat = t2SubCat"
That seems quite expensive in terms of processing. (Maybe it isn't)
The tables have the following key and field structure:
Table1
PK t1Date
pk t1Part
pk t1WH
t1ProdGrp
t1Cat
t1SubCat
....other fields.....
Table2
PK t2ProdGrp
pk t2Cat
pk t2SubCat
....other fields.....
Can anyone suggest an easier or better way to skin this cat?
Thanks,
Hexman
P.S. There are about 40 ProdGrps, each of the ProdGrps have 20 Cats
and each Cat has 3 - 20 SubCats.
Here's my situation. I have two tables. Table1 is a 'transaction'
table. Table2 is a 'master' table. What I want to do is two-fold.
First I want to check if there is a match between ProdGrp (t1ProdGrp =
t2ProdGrp). If there isn't a match, indicate on the transaction there
is a critical error.
If there is a match, check to see if there is a complete match
(t1ProdGrp = t2ProdGrp AND t1Cat = t2Cat AND t1subCat = t2SubCat). If
there is a full match flag the transaction as valid. If not a full
match, indicate on the transaction there is a minor (correctable)
error.
My original thought was to create 2 select statements and do 2 queries
against Table2.
"Select * from Table2 where t1ProdGrp = t2ProdGroup "
"Select * from Table2 where t1ProdGrp = t2ProdGroup AND _
t1Cat = t2Cat AND t1subCat = t2SubCat"
That seems quite expensive in terms of processing. (Maybe it isn't)
The tables have the following key and field structure:
Table1
PK t1Date
pk t1Part
pk t1WH
t1ProdGrp
t1Cat
t1SubCat
....other fields.....
Table2
PK t2ProdGrp
pk t2Cat
pk t2SubCat
....other fields.....
Can anyone suggest an easier or better way to skin this cat?
Thanks,
Hexman
P.S. There are about 40 ProdGrps, each of the ProdGrps have 20 Cats
and each Cat has 3 - 20 SubCats.