Do a query only if there are no results on previous query
- by yes123
Hi guys:
I do this query(1):
(1)SELECT * FROM t1 WHERE title LIKE 'key%' LIMIT 1
I need to do a second(2) query only if this previous query has no results
(2)SELECT * FROM t1 WHERE title LIKE '%key%' LIMIT 1
basically i need only 1 row who got the most close title to my key.
Atm i am using an UNION query with a custom field to order it and a LIMIT 1. Problem is I don't want to do the others query if already the first made the result.
Thanks