1. 程式人生 > >sql分組統計、最大值

sql分組統計、最大值

表名:history   欄位:DEPTH、ID等等

統計:select count(*) from (select * FROM history  where DEPTH =1 GROUP BY ID) TEMP

最大值:select max(ID) FROM history where DEPTH =1