Re: WHERE statement conditions

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Here is a quick trick for converting IF-THEN-ELSE procedural code in
declarative CASE expressions:


SELECT *
FROM MyTable
WHERE CASE WHEN company_name = 'LL'
THEN 'T'
WHEN company_name NOT IN ('XX', 'YY', 'ZZ')
AND col2 = 'P'
THEN 'T' ELSE 'F' END = 'T';

The CASE expression evaluates the WHEN clauses in order and returns
the value in the matching THEN clause as the result. The data type of
the CASE expression is the highest one in all the THEN clauses.
.



Relevant Pages

  • 3SAT is Almost 2SAT
    ... Any X3SAT instance can be converted ... A2SAT is actually 3SAT with a lot of binary clauses. ... Converting X3SAT to A2SAT: ...
    (sci.math)
  • 3SAT is Almost 2SAT
    ... Any X3SAT instance can be converted ... A2SAT is actually 3SAT with a lot of binary clauses. ... Converting X3SAT to A2SAT: ...
    (sci.logic)
  • 3SAT is Almost 2SAT
    ... Any X3SAT instance can be converted ... A2SAT is actually 3SAT with a lot of binary clauses. ... Converting X3SAT to A2SAT: ...
    (comp.theory)