I have a MessageThread table
UserUid ThreadUid
===================
K1 111
N1 111
K1 222
K1 333
N1 444
R1 111
R1 222
D1 333
E1 444
T1 555
One threadUid is only used for a same group of users.
K1 and N1 can on only have same ThreadUid.
if I know UserUid: K1 and N1
How can I know if K1 and N1 has a same ThreadUid?
Is there a way to get ThreadUid based on the provided UserUid? Seems impossible…
————
If the UserUid is K1 and N1
Result will be 111
If the UserUid is K1 and T1
Result will be empty
If the UserUid is N1 and E1
Result will be 444
To find threads that both users have in common:
Example at SQL Fiddle.