TRUNC(posting_date, 'MON') in both select & group by should do it.
"The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman
select to_char(posting_date,'Mon-YYYY'), sum(amount)
from w_card_transaction
where posting_date > to_date('31-12-2003','DD-MM-YYYY')
and posting_date < to_date('01-01-2005','DD-MM-YYYY')
group by to_char(posting_date,'Mon-YYYY'),Trunc(posting_date,'MON')
order by Trunc(posting_date,'MON');
Alternatively ...
Code:
Select to_char(mth,'Mon-YYYY'),amt
From
(
select Trunc(posting_date,'MON') mth, sum(amount) amt
from w_card_transaction
where posting_date > to_date('31-12-2003','DD-MM-YYYY')
and posting_date < to_date('01-01-2005','DD-MM-YYYY')
group by Trunc(posting_date,'MON')
order by 1
)
Ref DaPi's avatar -- have you ever read "The Picture of Dorian Gray"? 'Nuff said.
Ref DaPi's avatar -- have you ever read "The Picture of Dorian Gray"? 'Nuff said.
It's from the same photo as the old one, just shrunk & cropped differently (6KB and 80x80 pixel limit). I think I posted the complete thing once . . . . in Obfuscation I should think.
Of course I'm even older now.
"The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman
Bookmarks