SQL query:
SELECT SUM (gross_amount) /
(SELECT TO_CHAR (
LAST_DAY (TO_DATE (MAX (accounting_period), 'YYYYMM')),
'DD')
FROM t_beta_invoice)
FROM t_beta_invoice_details
I tried to calculate the daily invoice amount by dividing the total amount to the number of the days of given month in table t_beta_invoice. Firstly, i get the accounting period, which is in format of 'YYYYMM' and find the last day of it to calculate whether it contains 28,29,30 or 31 days.
But whenever i tried to run this , it gives me *ORA-00937: not a single-group group function*
. Can anyone help about this situation?