方法一:(效率最高)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 ...