天天看點

sqlite sql語句 備忘,資料統計

//擷取最大的

update jgyf  set 矮小植物名稱1 =  (select  矮小植物名稱 from jgxyf where jgxyf.樣方号 = jgyf.樣方号 order by jgxyf.矮小分蓋度 DESC)

//下來是次大的

update jgyf  set 矮小植物名稱1 =  (select  矮小植物名稱 from jgxyf where jgxyf.樣方号 = jgyf.樣方号 and jgxyf.矮小分蓋度 NOT IN ( select max(jgxyf.矮小分蓋度) from jgxyf where jgxyf.樣方号 = jgyf.樣方号)  order by jgxyf.矮小分蓋度 DESC)

//下來是所有的  逗号分割

select group_concat(jgxyf.矮小植物名稱,',') from jgxyf  where jgxyf.矮小分蓋度 NOT IN( select max(矮小分蓋度) from jgxyf group by 樣方号)  GROUP BY jgxyf.樣方号

//找出各項最大的值

select max(矮小分蓋度) from jgxyf group by 樣方号