I am working on an report for which am calling a function from front end. I am getting start month information as numbers starting from 1 to 12 and so am usin开发者_如何学Gog
substr(to_date(START_MONTH,'MM'),4,3)
to get month in the form of Jan, Feb etc, now in my function am grouping by start month and then ordering by start month and so in the output am getting values like
Apr, Aug, Dec as it is ordering by First alphabet of the month, how can I get correct order starting from Jan to Dec?
Any suggestions?
Also how to sort number so that 2 comes after 1 and not 10 after 1?
order by to_date( start_month, 'mm' )
?
Try this query
select TO_CHAR(T1.SCHDATE, 'Mon-YY') FROM FINSCHEDULEDETAILS T1
GROUP BY TO_CHAR(T1.SCHDATE, 'Mon-YY'),TO_CHAR(T1.SCHDATE, 'YYMM')
ORDER BY TO_CHAR(T1.SCHDATE, 'YYMM'));
精彩评论