Can someone please help me with this query:
SELECT
w.aboutme,
w.user_id,
IF ( (SELECT db2.user_relation.id FROM db2.user_relation
WHERE w.user_id = db2.user_relation.user_id AND
db2.user_relation.clients_id = 1), "true", "false") as selected,
(SELECT GROUP_CONCAT(DISTINCT name SEPARATOR ", ") FROM services
WHERE w.user_id = w.user_id) as services
FROM websites w, db2.user_relation
Everything works fine if db2.user_relation has some records but if it's empty the query returns 0 results, even though there are 4 records in the websites table.
And everything works if I take the IF statement out. So it appears my IF statement needs some tweaking.
Thanks for any help!