group by 两个字段 【给我发表点意见】
SELECT F.CREATEDDATE,COUNT(*) COUNT, AVG(F.FEATUREDEPTH) AVG, MAX(F.FEATUREDEPTH) MAXDEPTH, MAX(F.STATION) MAXSTATION,F.STATINEVENTID FROM INSPFEATURES F
WHERE F.FEATUREDEPTH IS NOT NULL AND F.STATION IS NOT NULL AND F.PISFLAGCONVERT !='2' AND F.PISFLAGCONVERT !='4' AND F.FEATURETYPE IN
('EMFL','EMF','EMFLA','IMFL','EMLL','IMLL','EML','IMF','IML','SWAL','GWA','LSAWS','SWA','SEAMWA','DENT','DENTGWSW','DENTGW','DENTSWML','DENTML','DENTSW','GOUG')
GROUP BY F.CREATEDDATE,F.STATINEVENTID ORDER BY F.CREATEDDATE
像这样的SQL语句 多一个分组字段
首先它会依第一个[CREATEDDATE]分组
列出一组数据,然后再依第二个[STATINEVENTID]分组。
假如:本身你只是想多添加一个字段来查询出来这样的话就会多一些不对数据
要是真想加一个字段并不在聚合函数内,还没有解决方法!希望大家提出解决方法!