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

Accumulate the data for month together


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

New User


Joined: 22 Apr 2008
Posts: 42
Location: coimbatore

PostPosted: Wed Mar 17, 2010 3:58 pm
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: 1020
Location: India

PostPosted: Wed Mar 17, 2010 6:43 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts SCOPE PENDING option -check data DB2 2
Search our Forums:

Back to Top