1
1
Fork 0
mirror of https://github.com/openvk/openvk synced 2025-03-10 19:49:45 +03:00
openvk/Web/Models/sql/get-correspondencies-count.tsql

20 lines
305 B
Text
Raw Normal View History

SELECT COUNT(id) AS cnt FROM
(
(
SELECT
recipient_id AS id
FROM messages
WHERE
sender_id = ?
AND
sender_type = ?
) UNION (
SELECT
sender_id AS id
FROM messages
WHERE
recipient_id = ?
AND
recipient_type = ?
)
) dt