mirror of
https://github.com/openvk/openvk
synced 2024-12-28 19:34:47 +03:00
31 lines
441 B
Text
31 lines
441 B
Text
|
SELECT DISTINCT id, class FROM
|
||
|
(
|
||
|
(
|
||
|
SELECT
|
||
|
recipient_id AS id,
|
||
|
recipient_type AS class,
|
||
|
created AS time
|
||
|
FROM messages
|
||
|
WHERE
|
||
|
sender_id = ?
|
||
|
AND
|
||
|
sender_type = ?
|
||
|
) UNION (
|
||
|
SELECT
|
||
|
sender_id AS id,
|
||
|
sender_type AS class,
|
||
|
created AS time
|
||
|
FROM messages
|
||
|
WHERE
|
||
|
recipient_id = ?
|
||
|
AND
|
||
|
recipient_type = ?
|
||
|
)
|
||
|
ORDER BY
|
||
|
time
|
||
|
DESC
|
||
|
) dt
|
||
|
LIMIT
|
||
|
?
|
||
|
OFFSET
|
||
|
?
|