Examples are as follows:
Data table is demotable, field has ID, condition1,condition2,condition3,condition4,condition5
The requirement is to query demotable, condition1,condition2,condition3,condition4,condition5 Five fields that meet any of two or more than two conditions.
You can use case when to implement this condition, requiring nested subqueries
Examples of SQL statement code are as follows:
Copy Code code as follows:
SELECT * from Demotable
WHERE (SELECT Case 1 when condition1 satisfies the condition THEN 1 ELSE 0 end from demotable)
+ (SELECT Case 1 when condition2 satisfies the condition THEN 1 ELSE 0 end from demotable)
+ (SELECT Case 1 when Condition3 satisfies the condition THEN 1 ELSE 0 end from demotable)
+ (SELECT Case 1 when condition4 satisfies the condition THEN 1 ELSE 0 end from demotable)
+ (SELECT Case 1 when condition5 satisfies the condition THEN 1 ELSE 0 end from demotable) >=2