I have two tables:
Table “items”:
| id | name | description |
| 1 | Michael | This is a random description blabalbla |
| 2 | Tom | This is another descriptions blablabla |
Table “moreitems”:
| id | name | description |
| 1 | Michael | This is a random description blabalbla |
| 2 | Mike | This is another descriptions blablabla |
| 3 | Michael | This is a random description blabalbla |
| 4 | Blain | This is another descriptions blablabla |
Currently, I’m fetching items from the first table like this:
SELECT * FROM items WHERE name = 'Michael' AND CHAR_LENGTH(description) > 10 LIMIT 3
I would like to include the second table in the query if the limit (3) has not been reached. How can I do that – without php?
Try: