group by 两个字段 【给我发表点意见】
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]分组。
假如:本身你只是想多添加一个字段来查询出来这样的话就会多一些不对数据
要是真想加一个字段并不在聚合函数内,还没有解决方法!希望大家提出解决方法!
相关推荐
godfather 2020-06-26
ItBJLan 2020-06-17
dreamhua 2020-06-05
明月清风精进不止 2020-04-21
明月清风精进不止 2020-02-17
ALiDan 2020-01-12
ztyzly00 2020-01-12
ALiDan 2020-01-04
tanrong 2019-12-28
dreamhua 2019-12-26
81911536 2019-12-14
xiaobaif 2019-12-13
一对儿程序猿 2019-12-08
azhou 2019-10-22
oraclemch 2019-07-05
sqlitexin 2019-07-25
汉武帝刘彻 2019-03-19
YFCEMBEDD 2019-06-30
zjyzz 2014-12-08