如何用MYSQL筛选出符合条件的记录?
表A字段
id(int) uid(int) type(int) utctime(bigint) msg(text)
现要根据时间(数值,找最大的那个), 筛选出每个用户最后记录的消息(msg), 还要区分出类别(type)
我写了一个
select * from A group by A.uid, A.type order by utctime desc
但总是找的utctime最小的那个, 即使是这样
select * from (select * from A order by A.utctime desc) B group by B.uid, B.type
还是不行, 不知道group到底是怎么运作的, 求解