Prioritize SQL WHERE clause
- by JaTochNietDan
Basically I want to do this:
SELECT * FROM `table` WHERE x = 'hello' OR x = 'bye' LIMIT 1';
I want it to return 1 value, but to prioritize results from the 1st where clause. So if there exists a row where column x's value is "hello", it will not return the result from the 'bye' value. If the "hello" value doesn't exist though, it will return the result from the 'bye' value.
Can't figure out a way to do it even though it seems fairly trivial. Any ideas?