SamScib
Technical User
- Jun 18, 2013
- 6
I have a table structured in the following way:
Part Fac1 Fac2 Fac3 Fac4 Fac5 Fac6 Fac7 Fac8
1a1 US US MX US US
1a2 CN CN CN CN
1b1 CN US MX CN
1b2 US US US US US US
1c1 US US US
1c2 CN CN CN CN CN
1c3 US CN
I actually have 34 columns, and used the following type of SQL logic to compare variables and RETURN ANY PART IN THE TABLE THAT HAS A VALUE OTHER THAN BLANK AND DOES NOT MATCH A VALUE IN A SEPARATE COLUMN.
Example: From the table above, I would want to return parts: 1a1, 1b1, and 1c3 as these are the rows with mis-matching data (not including blanks). Here is the code I used, and I am getting the error: Query is too Complex:
Select * from
where fac1 <> fac2 and fac1 <> "" and fac2 <> "" OR fac1 <> fac3 and fac1 <> "" and fac1 <> "", ........ etc. for about a million lines of code.
Needless to say, the query is too complex.
Is there any way to run a loop without calling out all 3 arguments and every single combination of checks in the code?
Thanks for the help!!
Sam
Part Fac1 Fac2 Fac3 Fac4 Fac5 Fac6 Fac7 Fac8
1a1 US US MX US US
1a2 CN CN CN CN
1b1 CN US MX CN
1b2 US US US US US US
1c1 US US US
1c2 CN CN CN CN CN
1c3 US CN
I actually have 34 columns, and used the following type of SQL logic to compare variables and RETURN ANY PART IN THE TABLE THAT HAS A VALUE OTHER THAN BLANK AND DOES NOT MATCH A VALUE IN A SEPARATE COLUMN.
Example: From the table above, I would want to return parts: 1a1, 1b1, and 1c3 as these are the rows with mis-matching data (not including blanks). Here is the code I used, and I am getting the error: Query is too Complex:
Select * from
where fac1 <> fac2 and fac1 <> "" and fac2 <> "" OR fac1 <> fac3 and fac1 <> "" and fac1 <> "", ........ etc. for about a million lines of code.
Needless to say, the query is too complex.
Is there any way to run a loop without calling out all 3 arguments and every single combination of checks in the code?
Thanks for the help!!
Sam