I am trying to perform a query in which I select several data from both tables where their relationship is NickName
at the beginning to take the messages had this code
SELECT * FROM $tabla WHERE UserEmitter IN ('$usuarioActual',
'$usuarioReceptor') AND UserReceiver IN ('$usuarioReceptor', '$usuarioActual')
AND seen = 1 ORDER BY created_at ASC
but now I want to also take the image of each user to show them in the view, I try to do it with
SELECT DISTINCT m.*
FROM messages m
WHERE m.UserEmitter IN ('cesgdav', 'cesgdav2') AND m.UserReceiver IN ('cesgdav2', 'cesgdav') AND seen = 1
ORDER BY created_at ASC
(SELECT picture
FROM users u
WHEREu.nickname IN ('cesgdav', 'cesgdav2'))
but when running the query it indicates an error in the second select