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!

monthly sum records

User_G2BGVJan 31 2020 — edited Jan 31 2020

Hi masters,

I written a query for getting count(*) sum of records for each quarter. But customer wants each day count and at the end of the month sum of devices. like that quarterly I have to display.

my query

+++++++

select count(*)
from device
where inserted BETWEEN ('01-JAN-2019')
AND ('30-APR-2019')
and managed=1
and in_use=1; --->  27399

But they wanted to display like this ..
DATE                 MANAGED             IN_USE     COUNT(DEVICE)
+++++               +++++++++             +++++++   +++++++++++++++
01-JAN-2019        1                             1                23
02-JAN-2019        1                             1                44
:
;
31-JAN-2019         1                            1                34  
Sum of device                              ----                                899
01-feb-2019          1                           1                  90
02-feb-2019          1                           1                  23
:
:
28-feb-2019          1                           1                  32    
Sum of devices                         ---                                     900
Please advise..
BR
Frd
Comments
Post Details
Added on Jan 31 2020
7 comments
1,604 views