------------------------------------------------有id,name,createDate的一張表testTable--根據name分組,獲取每組中createDate最大的那條記錄(整條)查詢 ...
select from bdcdj.lqentry a where 順序號 in select max 順序號 from bdcdj.lqentry b WHERE b.archival code IS NOT NULL group by archival code 通過archival code分組,取順序號的最大值。 ...
2019-10-21 10:56 0 614 推薦指數:
------------------------------------------------有id,name,createDate的一張表testTable--根據name分組,獲取每組中createDate最大的那條記錄(整條)查詢 ...
方法一:(效率最高)select * from test as a where typeindex = (select max(b.typeindex) from test as b where ...
--有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 ...
案列: 想更新A表的name字段,由於失誤,在寫這個表的時候,這個字段沒有寫,發現的時候,已經寫了一個多月的數據了。改了之后的過程,會正常的寫這個字段, 可是已經寫了的數據也不能鏟了,重新計算。 好在A表的name是可以從B表通過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 ...