openvk/Web/Models/sql/get-messages.tsql

28 lines
388 B
Text
Raw Normal View History

2020-06-07 19:04:43 +03:00
SELECT
*
FROM
`messages`
WHERE
(`deleted` = 0)
2020-08-01 17:30:08 +03:00
AND (`id` > ?)
2020-06-07 19:04:43 +03:00
AND (
(
(`sender_type` = ?)
AND (`recipient_type` = ?)
AND (`sender_id` = ?)
AND (`recipient_id` = ?)
)
OR (
(`sender_type` = ?)
AND (`recipient_type` = ?)
AND (`sender_id` = ?)
AND (`recipient_id` = ?)
)
)
ORDER BY
`created` DESC
LIMIT
2020-08-01 17:30:08 +03:00
?
OFFSET
?