我有一个数据库表,如下所示:
messages_table:
transmitter_ename: varchar(40)
message: varchar(600)
timestampt: datetime
read: boolean
是否有选项可以在sql语句中选择来自不同用户的10条最新消息?
答案 0 :(得分:-1)
SELECT
*
FROM
(SELECT * FROM messages_table as mt ORDER BY mt.timestampt DESC) AS messages_table
GROUP BY
messages_table.transmitter_ename
LIMIT 10;