interview question [message #476022] |
Mon, 20 September 2010 13:52 |
irssharma
Messages: 1 Registered: September 2010
|
Junior Member |
|
|
i have three columns
Region revenuefact1 revenuefact2
and it has the data which resembles like
Region Revenuefact1 Revenuefact2
A 100 200
B 230 2300
c 124 123
D 123 900
is it possible to add 'C' and 'D' row and show the data in the same report hiding the C and D rows and showing the data of there summation in the new row.
is it possible.
this was a interview question in HCL
|
|
|
Re: interview question [message #492439 is a reply to message #476022] |
Mon, 31 January 2011 04:34 |
sstellini
Messages: 32 Registered: April 2005 Location: Malta
|
Member |
|
|
I would do this:
select *
from test
where region in ('A','B')
UNION
select 'C+D',sum(revenue1),sum(revenue2)
from test
where region in ('D','C')
|
|
|