sql >> Base de Datos >  >> RDS >> Mysql

SQL obtiene usuarios que han recibido o enviado mensajes (ACTUALIZAR)

RESUELTO CON:

SELECT * FROM users WHERE NOT unique_id = "337244286" and unique_id in (
SELECT outgoing_msg_id FROm messages WHERE incoming_msg_id="337244286") 
UNION 
SELECT * FROM users WHERE NOT unique_id = "337244286" and unique_id in (select incoming_msg_id from messages WHERE outgoing_msg_id="337244286")