IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Pivot in DB2


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Ron Klop

New User


Joined: 28 Sep 2012
Posts: 28
Location: holland

PostPosted: Wed Oct 30, 2019 8:31 pm
Reply with quote

Hai,

I have a table in which there are two krt_anbdr_id's.
I sum number and amount grouped by these idea's.
See attachment because I really don't know how to make up the message otherwise.

When typing it in here it gets scrambled.

Regards Ron
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Wed Oct 30, 2019 10:32 pm
Reply with quote

Please check these links.

ibmmainframes.com/about59073.html
ibmmainframes.com/about45873.html
ibmmainframes.com/about65584.html
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Oct 31, 2019 12:58 am
Reply with quote

Use the full editor and enclose your data in the code tags.
Back to top
View user's profile Send private message
Ron Klop

New User


Joined: 28 Sep 2012
Posts: 28
Location: holland

PostPosted: Thu Oct 31, 2019 2:42 am
Reply with quote

Gnanas N wrote:
Please check these links.

ibmmainframes.com/about59073.html
ibmmainframes.com/about45873.html
ibmmainframes.com/about65584.html


Been reading the links, but still find it difficult to answer my own question
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Oct 31, 2019 3:00 am
Reply with quote

downloaded the attachment and reposted INLINE,

Code:

I have a table in which there are two krt_anbdr_id's.
I sum number and amount grouped by these idea's. This is the outcome.

select KRT_ANBDR_ID ,                                         
sum(krt_tx_aant) as number,                                           
sum(krt_bedr) as amount                         
from gwsddba5.gwtb762                                                 
group by KRT_ANBDR_ID                                         
;                                                                     
---------+---------+---------+---------+---------+---------+---------+-
KRT_ANBDR_ID     NUMBER                  AMOUNT
---------+---------+---------+---------+---------+---------+---------+-
101                1.                     6055.
103                3.                    18165.

But I would like to see the output in another form

        101     103
Number  1       3
Amount  6055    18165



NOTHING GOT SCRAMBLED
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Search our Forums:

Back to Top