I can not figure out how to do this in MySQL 4.0.12.
The rule is, in English, if an account has a Code1 then it should not have a Code2. I need to find all of the T1.Code values that break this rule.
Table1 (T1) [50,000 accounts; Approx 20 codes per acct]
Account
Code
Table2 (T2) Has 200,000 records
Code1
Code2
I need to get all accounts where one of T1.Code matches a T2.Code1 value, and the same T1.Account has another T1.Code that matches a T2.Code2 value.
I specifically need the T1 record where T1.Code = T2.Code2. The final recordset will be only these records.
I have no restrictions on how to accomplish this. Temp tables are ok. Needs to be fairly quick though.
All help is greatly appreciated!
Thank you.
The rule is, in English, if an account has a Code1 then it should not have a Code2. I need to find all of the T1.Code values that break this rule.
Table1 (T1) [50,000 accounts; Approx 20 codes per acct]
Account
Code
Table2 (T2) Has 200,000 records
Code1
Code2
I need to get all accounts where one of T1.Code matches a T2.Code1 value, and the same T1.Account has another T1.Code that matches a T2.Code2 value.
I specifically need the T1 record where T1.Code = T2.Code2. The final recordset will be only these records.
I have no restrictions on how to accomplish this. Temp tables are ok. Needs to be fairly quick though.
All help is greatly appreciated!
Thank you.