Home » Developer & Programmer » Reports & Discoverer » Month and YTD total
Month and YTD total [message #133087] Wed, 17 August 2005 12:07 Go to next message
reach_honey
Messages: 10
Registered: June 2005
Location: Boston
Junior Member
I'm trying to display monthly and ytd total on my sql.
For ex. table A has following data

Description ID Receipt_date
1 1 01-jul-05
1 2 05-JUL-05
1 3 01-FEB-05
2 4 01-JUL-05
2 5 31-JUL-05
2 6 01_JAN-05

My output for month of July and YTD should be as

Description Month total Year total
1 2 3
2 2 3

I have 2 different sql but how do i combine into one to get this required value.
SQL
select x.description,count(y.id)monthly
from x,y,z
where x.id=y.id and
y.id=z.id and
z_signed_dt ='Y' and
x.receipt_date between 01-JUL-05 and 31-JUL-05
-----------
Yearly
select x.description,count(y.id)yearly
from x,y,z
where x.id=y.id and
y.id=z.id and
z_signed_dt ='Y' and
x.receipt_date between 01-JAN-05 and 31-JUL-05

How do i combine and bring them into one value?
Any help would be appreciate.
Thanks,
Reach_honey
Re: Month and YTD total [message #134264 is a reply to message #133087] Wed, 24 August 2005 02:25 Go to previous message
skooman
Messages: 913
Registered: March 2005
Location: Netherlands
Senior Member
(a) search on YTD on this forum
(b) try to use analytics:
sum(xxx) over (partition by year) YTD

Regards,
Sabine
Previous Topic: Show values
Next Topic: MONTH NAME and YEAR on Report Title
Goto Forum:
  


Current Time: Sun Jun 23 14:50:03 CDT 2024