Subquery returns more than 1 row MySql

1

Follow the code below that is causing the error quoted in the title:

select (select id from message where user_from = tempMsg.user OR user_to = tempMsg.user) as id from tempMsg

How can I solve it? Could someone help me fast?

    
asked by anonymous 07.11.2017 / 01:19

1 answer

0

Instead of this subquery try this:

select a.id
from message a 
inner join tempMsg b
on a.user_from = b.user
and a.user_to = b.user
    
07.11.2017 / 02:17