Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Group by multiply rows - HARD

user13520646Oct 10 2011 — edited Oct 10 2011
Hi,
NAME | SURNAME| x | y | BIRTH_DAY
KRIS | ONE | 324 | 52 | 2011-09-12
KRIS | SIX | 222 | 111 | 2011-09-13
KRIS | SSS | 1558 | 13 | 2011-09-13
ANNA | DDD | 7486 | 0 | 2011-09-12
TOM | DDD | 4853 | 111 | 2011-09-12
JERRY | DDD | 6402 | 112 | 2011-09-12
JACK | DDD | 957 | 113 | 2011-09-15
JACK | DDD | 11445 | 368 | 2011-09-19

I have problem.
I need to group all this data per name column, so each name needs to have only one row, x must be summed, y must be summed and from surname and birthday column values may be taken randomly. So at the finall I will have one row per one name containig summed values from x and y column and surname and_birthday values may be taken randomly. Examle how it shoul look for KRIS ROW:

KRIS | SIX | 546 | 163 | 2011-09-13

For KRIS SURNAME column value six was taken randomly from ONE and SIX values, x and y was summed and value for BIRTH_DAY column was taken randomly from 2011-09-12 and 2011-09-13 dates.

I have no idea how can I do it.
May I ask you for help?

Edited by: user13520646 on 2011-10-10 09:17
This post has been answered by Brian Bontrager on Oct 10 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 7 2011
Added on Oct 10 2011
2 comments
339 views