mysql分组排序取最大、最小、最新、前N条记录_select * from tb a where 100>=(select 1 from tb b -CSDN博客

网站介绍:文章浏览阅读879次。先看一下本示例中需要使用到的数据创建表并插入数据: create table tb(name varchar(10),val int,memo varchar(20)) insert into tb values('a', 2, 'a2') insert into tb values('a', 1, 'a1') insert into tb values('a', 3, 'a3') insert into tb values('b', 1, 'b1._select * from tb a where 100>=(select 1 from tb b where a.substring(shopid,1