什么是分组函数:分组函数作用于一组数据,并对一组数据返回一个值。
组函数类型:AVG COUNT SUM MAX MIN STDDEV
分组:单列分组 和多列分组
代码如下:
[img]http://dl.iteye.com/upload/attachment/475241/f97c083d-d9f6-350e-8687-76d1a3384608.jpg[/img]
怎么对分组进行再过滤:having子句 代码如下:
[img]http://dl.iteye.com/upload/attachment/475233/9829a720-366e-394f-a776-63f271146c76.jpg[/img]
组函数类型:AVG COUNT SUM MAX MIN STDDEV
分组:单列分组 和多列分组
代码如下:
select im.taxpayer_id, im.OPERATOR, trunc(sum(im.small_sum), 2)
from pms_invoice_main im
group by im.taxpayer_id, im.OPERATOR order by im.taxpayer_id
[img]http://dl.iteye.com/upload/attachment/475241/f97c083d-d9f6-350e-8687-76d1a3384608.jpg[/img]
怎么对分组进行再过滤:having子句 代码如下:
select im.taxpayer_id, im.OPERATOR, trunc(sum(im.small_sum), 2)
from pms_invoice_main im
group by im.taxpayer_id, im.OPERATOR having max(im.small_sum)>1115739
order by im.taxpayer_id
[img]http://dl.iteye.com/upload/attachment/475233/9829a720-366e-394f-a776-63f271146c76.jpg[/img]