I am doing a query, in which the second query can give "NULL" or a value (if there is data).
SELECT *, (SELECT tb1.image FROM ce_users_images tb1
WHERE tb1.iduser = users.iduser LIMIT 1) AS tmp1
FROM ce_users users
WHERE users.id_user=4
LIMIT 1
I want to return NULL in this second query, return a default value, otherwise it gives the value of the query.
I tried to use an IFNULL, but it always gives me error. Can you help with this in the query ??