【功能】統計數據表選中行x列的合計值。
【參數】all表示對所有的值求合計值,distinct只對不同的值求合計值,默認為all
如果有參數distinct或all,需有空格與x(列)隔開。
【參數】x,只能為數值型字段
【返回】數字值
【示例】
環境:
create table table3(xm varchar(8),sal number(7,2));
insert into table3 values('gao',1111.11);
insert into table3 values('gao',1111.11);
insert into table3 values('zhu',5555.55);
commit;
執行統計:
select SUM(distinct sal),SUM(all sal),SUM(sal) from table3;
結果: 6666.66 7777.77 7777.77