qshpeng 2011-03-17
SELECTF.CREATEDDATE,COUNT(*)COUNT,AVG(F.FEATUREDEPTH)AVG,MAX(F.FEATUREDEPTH)MAXDEPTH,MAX(F.STATION)MAXSTATION,F.STATINEVENTIDFROMINSPFEATURESF
WHEREF.FEATUREDEPTHISNOTNULLANDF.STATIONISNOTNULLANDF.PISFLAGCONVERT!='2'ANDF.PISFLAGCONVERT!='4'ANDF.FEATURETYPEIN
('EMFL','EMF','EMFLA','IMFL','EMLL','IMLL','EML','IMF','IML','SWAL','GWA','LSAWS','SWA','SEAMWA','DENT','DENTGWSW','DENTGW','DENTSWML','DENTML','DENTSW','GOUG')
GROUPBYF.CREATEDDATE,F.STATINEVENTIDORDERBYF.CREATEDDATE
像这样的SQL语句多一个分组字段
首先它会依第一个[CREATEDDATE]分组
列出一组数据,然后再依第二个[STATINEVENTID]分组。
假如:本身你只是想多添加一个字段来查询出来这样的话就会多一些不对数据
要是真想加一个字段并不在聚合函数内,还没有解决方法!希望大家提出解决方法!