I'd like to create a query with following functionality.
Whatever my query returns 0 records the query will fetch the data by other clause.
If the first clause will fetch some records the second clause will be ignored.
I'm supposing to get either one record.
In sql it would be something like this
SELECT * FROM users WHERE name = 'User1'
UNION ALL
SELECT * FROM users WHERE name = 'Default'
AND NOT EXISTS (SELECT 1 FROM users WHERE name='User1')