oracle function SUM ([distinct | all] x)

[Function] the total value of the statistics table to select rows x columns.

 

Parameters all means sum total value of all values, distinct only to find the total value of the different values, the default is all

If there are distinct parameter or all, the need for space-separated with x (column).

 

Parameters x, can only numeric field

 

[Return] numeric value

 

[Example]

surroundings:

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;

 

Execution Stats:

select SUM(distinct sal),SUM(all sal),SUM(sal) from table3;

Results: 6666.66 7777.77 7777.77

Guess you like

Origin www.cnblogs.com/fanweisheng/p/11119334.html