php - Select rows with same value on other field -
so, have entity (i'm using symfony) participant
.
in entity have : id
account_id
conversation_id
account_id
user
object, , conversation_id
conversation
object, both foreign keys.
i need know if, start, user1 , user2 in same conversation. , after need know if user1, user2.... usern in same conversation.
i don't know how query ? !
select n.* participant n join ( select t.conversation_id participant t t.user_id = 'user1' , t.conversation_id = (select conversation_id participant user_id = 'user2' , conversation_id = t.conversation_id) ) m on m.conversation_id = n.conversation_id
Comments
Post a Comment