Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Pivot in DB2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Pivot in DB2
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    Post subject:
Reply with quote

Please check these links.

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

Global Moderator


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

PostPosted: Thu Oct 31, 2019 12:58 am    Post subject: Reply to: Pivot in DB2
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    Post subject:
Reply with quote

Gnanas N wrote:
Please check these links.

http://ibmmainframes.com/about59073.html
http://ibmmainframes.com/about45873.html
http://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

Senior Member


Joined: 14 Mar 2007
Posts: 10631
Location: italy

PostPosted: Thu Oct 31, 2019 3:00 am    Post subject: Reply to: Pivot in DB2
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:


Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us