2
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 intend that if you return NULL in this second query, return me a default value, otherwise it gives the query value.
I tried to use an IFNULL, but I was always wrong. You can help perform this in the query??
what the default value would be ?
– Rovann Linhalis
because in subselect you use
users.iduser
and in selectuser.id_user
??– Rovann Linhalis