Answer the question
In order to leave comments, you need to log in
Can this be done in postgresql?
Answer the question
In order to leave comments, you need to log in
SELECT dialogs_users.* FROM dialogs_users
LEFT JOIN dialogs ON dialogs.id = dialogs_users."dialogId"
WHERE
dialogs.type = 'personal'
AND
dialogs_users."userId" IN ('69e56a68-edbd-4f8b-8ccd-cb8031c5c865', '06b475b7-8f12-4879-bea4-e8f22ef85a46')
AND
dialogs_users."dialogId" IN (SELECT dialogs_users."dialogId" dialogId FROM dialogs_users GROUP BY dialogId HAVING COUNT(*) > 1);
If I understand correctly, then
SELECT
du.userId
FROM
dialogs_users du
INNER JOIN dialogs d
ON du.dialogId = d.id
WHERE
d.type = 'personal' AND du.dialogId = $dialogId
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question