I have three columns with three values that can be set for each column
Column_1 | column_2 | column_3
________ | ________ | ________
COMPLETED| FAILED | PENDING
COMPLETED| COMPLETED| COMPLETED
FAILED | COMPLETED| COMPLETED
COMPLETED| PENDING | COMPLETED
COMPLETED| COMPLETED| PENDING
COMPLETED| COMPLETED| COMPLETED
COMPLETED| COMPLETED| COMPLETED
PENDING | COMPLETED| COMPLETED
Looking for two queries, One to find any record with a PENDING status and the other to find any records with a FAILED status
NOTE: PENDING and FAILED should have the same logic
Query: PENDING
SELECT * FROM tbl
WHERE Column_1 = 'PENDING' OR Column_2 = 'PENDING' OR Column_3 = 'PENDING'
Query: FAILED
SELECT * FROM tbl
WHERE Column_1 = 'FAILED' OR Column_2 = 'FAILED' OR Column_3 = 'FAILED'
These queries are not pulling the correct records. I think it's matching the first condition in the WHERE clause and then doing the OR clause as a separate condition. I've tried a couple variations but still no luck.
Alt Query:
SELECT * FROM tbl
WHERE Column_1 OR Column_2 OR Column_3 = 'PENDING'
So for the PENDING status, the query should return 4 rows for the data grid above and for the FAILED status, the query should return 2 rows for the data grid above