Home » SQL & PL/SQL » SQL & PL/SQL » yearwise revenue - reg
yearwise revenue - reg [message #19426] Fri, 15 March 2002 19:37 Go to next message
ARANGASWAMY
Messages: 1
Registered: March 2002
Junior Member
Sir,

I want to take financial yearwise revenue i.e. like (April, 1999 to March,2000), (April, 2000 to March 2001), etc.

The table in question contain the column named as 'YYMM' and entries in this column would be like 199903, 199904, 199905, etc.

The column meant for revenue is also in the same table named as 'EXCISE_DUTY'.

How to do this.

If u post the reply quickly it would be of much use.

With warm regards,

Arangas.
Re: yearwise revenue - reg [message #19428 is a reply to message #19426] Sat, 16 March 2002 02:29 Go to previous messageGo to next message
Srihari
Messages: 22
Registered: October 2000
Junior Member
Details are not sufficient.

Assuming that YYMM column as Number datatype the query will look like :

select sum(EXCISE_DUTY) from table_name where YYMM
between 199904 and 200003;

this will display the total excise for financial year
April,1999 - Mar,2000.

Hope this might help U

Please Revert back with more details if this query does not help U

Srihari
Re: yearwise revenue - reg [message #19437 is a reply to message #19426] Sun, 17 March 2002 20:58 Go to previous messageGo to next message
V.ARANGASWAMY
Messages: 4
Registered: March 2002
Junior Member
The column YYMM is of NUMBER datatype only. The first four digits (left to right) indicate the year and the remaining two digits indicate the month.

What u have given groups the revenue only for one year.

I want the GROUPING for multiple years such as April, 1999 to March, 2000 (1 set), April 2000 to March, 2001 (another), so on.

Hope this throws some light to the query posted by me.

Kindly help me out quickly.

Thanks
Re: yearwise revenue - reg [message #19439 is a reply to message #19437] Mon, 18 March 2002 00:04 Go to previous message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
try this

select trunc(yymm/100)-decode(to_number(substr(yymm,-1,2)),1,1,2,1,3,1,0) financial_year,
sum(excise_duty)
from your_table_name
group by trunc(yymm/100)-decode(to_number(substr(yymm,-1,2)),1,1,2,1,3,1,0)
/

hope it helps!!!
Previous Topic: Substr a column
Next Topic: Unsure about my statements.. Need HELP urgently!! THANX
Goto Forum:
  


Current Time: Sat May 18 21:27:45 CDT 2024