Hello,
I have a table with two columns, one is ID and the other is VALUE. I’m looking to find a way to sum data that includes formatted numbering with commas (i.e. 99,999,999). The sum I’d like to report is dynamic and will change based on filtering in the where clause. Sometimes there will be 1 comma in the sum. Other times there may be more than 1.
The table name is called SUM_DATA and shown below.
ID VALUE
T 152000
U 118000
V 210000
W 28000
X 3200
Y 450800
Z 430
Below are my create table and insert scripts.
CREATE TABLE SUM_DATA(ID VARCHAR(1), VALUE NUMBER)
;
insert all
into SUM_DATA (ID, VALUE)
VALUES ('T','152000')
into SUM_DATA (ID, VALUE)
VALUES ('U','118000')
into SUM_DATA (ID, VALUE)
VALUES ('V','210000')
into SUM_DATA (ID, VALUE)
VALUES ('W','28000')
into SUM_DATA (ID, VALUE)
VALUES ('X','3200')
into SUM_DATA (ID, VALUE)
VALUES ('Y','450800')
into SUM_DATA (ID, VALUE)
VALUES ('Z','430')
select 1 from dual
;
Below is the desired output.
962,430
How would I go about achieving this result using SQL? I am using SQL Developer version 19.2.1.247.2212.