你好,我有这样一个模式,表名提要
其中msg_id是唯一的,它是表的主键。
msg_id评论评论
/.=‘1,1,1,1,1,1,3,1,3,3,4,4,0.
/.=‘1,1,1,1,1,3,1,3,=’3‘1,4,1,4,1,2,2,4,4.
商业、商业、金融、商业、金融等行业
我想要构建一个查询,它将选择最后两行
输出应该是这样的
msg_id评论评论
/.=‘1,1,1,1,1,3,1,3,=’3‘1,4,1,4,1,2,2,4,4.
商业、商业、金融、商业、金融等行业
简而言之,查询应该返回具有不同注释值的msg_id行
发布于 2014-11-07 10:30:39
按列分组为唯一,并为每个组选择最高id。
select max(msg_id) as msg_id, commented
from your_table
group by commented发布于 2014-11-07 10:31:48
试试这个-
select max(msg_id), commented from your_table group by commented发布于 2014-11-07 11:28:16
按注释从提要组选择*
https://stackoverflow.com/questions/26799133
复制相似问题