我有一个名为 ms_message 的数据库表:有 6 列(id、senderid、receiverid、content、isRead、receivedTime)。我想通过 Doctrine 中的发件人获取最新收到的消息组,但我无法运行子查询或使用 order by 和 group by。
SQL 中的查询如下所示:
SELECT * FROM (SELECT * FROM ms_message WHERE receiverId = :receiver ORDER BY receivedTime) GROUP BY senderId;