Displaying * items along with total sum

N

naveen prasad

Dear all,
kindly solve my problem

I have created a table d1.

d1 fields, Id, date ,r1,r2 r1,r2 are numeric values only.

I want to get a result which will display all the details of the table
like for example result of select * from d1;
with the result I want in the sum of individual rows like sum(r1) ,sum(r2)
also to be diplayed in the last row.


like example d1 table if we consider r1,r2

20 25
15 15
10 10

now i want the result like below, all details along with sum at bottom

20 25
15 15
10 10

45 50


regards
 
K

KARL DEWEY

Try this --
SELECT Id, date, r1, r2
FROM d1
UNION ALL SELECT Null, Null, Sum(r1) AS [XX], SUM(r2) AS [YY]
FROM d1;
 
N

naveen prasad

Excellent dear your formula made my problem solved.

thanks alot for your kind response..


regards


KARL DEWEY said:
Try this --
SELECT Id, date, r1, r2
FROM d1
UNION ALL SELECT Null, Null, Sum(r1) AS [XX], SUM(r2) AS [YY]
FROM d1;

--
Build a little, test a little.


naveen prasad said:
Dear all,
kindly solve my problem

I have created a table d1.

d1 fields, Id, date ,r1,r2 r1,r2 are numeric values only.

I want to get a result which will display all the details of the table
like for example result of select * from d1;
with the result I want in the sum of individual rows like sum(r1) ,sum(r2)
also to be diplayed in the last row.


like example d1 table if we consider r1,r2

20 25
15 15
10 10

now i want the result like below, all details along with sum at bottom

20 25
15 15
10 10

45 50


regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top