Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Accumulate the data for month together

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
d_sarlie

New User


Joined: 22 Apr 2008
Posts: 32
Location: coimbatore

PostPosted: Wed Mar 17, 2010 3:58 pm    Post subject: Accumulate the data for month together
Reply with quote

I have a table which has ten columns.In one of the column I have month.The value will be like "Jan" "Feb" "Mar" etc.,.These records are not ordered based on month.I want to write a query which will give me the jan data first then Feb data and so on.

Can someone help me out.
Back to top
View user's profile Send private message

sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Wed Mar 17, 2010 6:43 pm    Post subject:
Reply with quote

Sarlie,

Try like the following,
Code:
select id,
(case month
when 'Jan' then '1'
when 'Feb' then '2'
when 'Mar' then '3'
when 'Apr' then '4'
when 'Jun' then '5'
END ) as mon
from table1
order by mon


Start Reading 'DB2 V9 SQL reference' Manual.

Sushanth
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:

Similar Topics
Topic Author Forum Replies Posted
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm
No new posts SPUFI -- Joining 3 tables – data in... Sysaron DB2 2 Wed Mar 08, 2017 4:18 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us