--有id,name,createDate的一張表testTable--根據name分組,獲取每組中createDate最大的那條記錄(整條)查詢出來---------------------------------------------- 創建一張表,語句如下: CREATE TABLE ...
方法一: 效率最高 select from test as awhere typeindex select max b.typeindex from test as bwhere a.type b.type 方法二: 效率次之 selecta. from test a, select type,max typeindex typeindex from test group by type bwh ...
2019-11-21 10:28 0 388 推薦指數:
--有id,name,createDate的一張表testTable--根據name分組,獲取每組中createDate最大的那條記錄(整條)查詢出來---------------------------------------------- 創建一張表,語句如下: CREATE TABLE ...
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 ...