Home > database >  The oracle stored procedure, query the records of each month
The oracle stored procedure, query the records of each month

Time:10-26

Oracle stored procedure, query the records of each month, if not that month that month is 0, 12 months data list, return is

Bosses, will write?

Before I use mysql

Select (
(select count (0) from XXXX... ) as "in January,"
(select count (0) from XXXX... ) as "in February,"
(select count (0) from XXXX... ) as "march",
,,,
)

But oracle can't write, bosses, urgent for

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Find a simple way, but there is no data and data in month, there is no

The select to_char (created_time, 'MM) mon, count (*) num from mp_component_info t
Where to_char (created_time, 'yyyy')='2018'
Group by to_char (created_time, 'MM)
The order by mon

,,,,,,,,

CodePudding user response:

The select level from dual connect by level & lt; Outside=12 links
  • Related