Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Group by on date column to get the total count for month/Year.

user10151069Aug 8 2018 — edited Aug 9 2018

I need help on getting the right out put with the SQL.

Oracle 12c

my code::

select created_date, count(*)
from

( select
to_char(created_date,'MON') ||'/'|| to_char(created_date, 'YYYY') as
"CREATED_DATE"  from oms_llog)

GROUP BY created_date

ORDER BY 1;

APR/2010           9125

APR/2011           21613

APR/2012           2457

APR/2013           32732

APR/2014           41884

APR/2015           58575

APR/2016           57714

APR/2017           60009

APR/2018           70491

As of now I am getting the output as alphabetical like all April's for all the years then August for all years. How to rewrite the SQL to get the below.

APR/2010     xxxxxx

MAY/2010    xxxx

JUN/2010     xxxxxx

JUL/2010      xxxxxxxx

and so on....

This post has been answered by Sven W. on Aug 9 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 6 2018
Added on Aug 8 2018
14 comments
7,064 views