You can also refer to this query below if you know the number of columns and values.
The CASE statement is the closest to IF in SQL SELECT CASE WHEN (col1 = 'A' and col2 = 'B' and col3='C') or (col1 = 'C' and col2 = 'A' and col3='B') or (col1 = 'B' and col2 = 'C' and col3='A' ) THEN 1 ELSE 0 END as RESULT, * FROM table
From the result, you can take the required output by checking the value RESULT==1(integer)
If you want result as a boolean value , then do CAST like,
SELECT CAST( CASE WHEN (col1 = 'A' and col2 = 'B' and col3='C') or (col1 = 'C' and col2 = 'A' and col3='B') or (col1 = 'B' and col2 = 'C' and col3='A' ) THEN 1 ELSE 0 END as RESULT_INT) as RESUTL, * FROM table
source share