The data table is designed as follows:
SELECT * FROM `xds_message` WHERE `user_id` = '0a9064ba-711f-5049-9300-c0cc88e1edf7' AND `delete_time` = 0 GROUP BY to_user_id ORDER BY create_time ASC
The results are as follows:
When I change the ranking rule to
create_time DESC，give the result as follows
Is there any way to group time?
create_timeSort, now after grouping
contentThe values are the first ones. Can we group them in accordance with them?
create_timeSort or get the latest one?
select * from (SELECT * FROM xds_message WHERE user_id = '0a9064ba-711f-5049-9300-c0cc88e1edf7' AND delete_time = 0 ORDER BY create_time DESC) AS msg_temp GROUP BY msg_temp.to_user_id;
Operationally, sorting and grouping is fine, but the different database implementations do not necessarily perform the same, but MySQL does
You can use recordid=1 to get it, Oracle is OK, MySQL and Oracle should be the same.