方法一:(效率最高)select * from test as a where typeindex = (select max(b.typeindex) from test as b where ...
有id,name,createDate的一张表testTable 根据name分组,获取每组中createDate最大的那条记录 整条 查询出来 创建一张表,语句如下: CREATETABLE dbo . testTable id int NOTNULLIDENTITY , , name nchar COLLATEChinese PRC CI ASNULL, counts int NULL, c ...
2017-06-23 09:06 0 6570 推荐指数:
方法一:(效率最高)select * from test as a where typeindex = (select max(b.typeindex) from test as b where ...
SQL 分组后获取其中一个字段最大值的整条记录 方法一:(效率最高)select * from test as a where typeindex = (select max(b.typeindex) from test as b where a.type = b.type ...
------------------------------------------------有id,name,createDate的一张表testTable--根据name分组,获取每组中createDate最大的那条记录(整条)查询 ...
); 通过archival_code分组 ,取顺序号的最大值。 ...
1、 SELECT wmsys.wm_concat(t.org) orgs, t.area_nameFROM (SELECT concat(concat(b.abbreviation, '-'), ...
来自https://blog.csdn.net/gaoyao99409/article/details/19003729 select m.parent_id, m.st ...
方法一 select t1.a,t1.b,t1.c from test t1 inner join (seelct a,max(b) as b from test group ...
场景:sql server 2008 目标: select COUNT(*) from ID group by code 产生code列唯一的3行数据,并显示最小的D列数据 方案1: select code,MIN(D)from ID group ...