This discussion is archived
7 Replies Latest reply: Sep 10, 2013 8:51 AM by admin1 RSS

How to add or merge 2 rows together in a result set

Johnbr (Oracle10G) Newbie
Currently Being Moderated

Hi All,

 

What is the easiest way to add 2 rows together? I need this results set below as is except I need rows with activity codes 0 and 30 to be merged together into Activity Code 0. So, Regular hours would be 7466.75. Do I need to do a Union or is there a more elegant solution?

 

My current sql results set looks something like this:

 

Activity CodeActivity Code DescREGULAROTNONPRODDEPARTMENT
00: Business As Usual7409.25305.51603.25Information Technology
1010: Special Projects190.75170Information Technology
2020: Strategic Initiatives1067520Information Technology
300: Business As Usual57.500Information Technology

 

and I want my new results to look like this:

 

Activity CodeActivity Code DescREGULAROTNONPRODDEPARTMENT
00: Business As Usual7466.75305.51603.25Information Technology
1010: Special Projects190.75170Information Technology
2020: Strategic Initiatives1067520Information Technology

 

Thanks

 

John

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points