Home » SQL & PL/SQL » SQL & PL/SQL » Quarter year (oracle reports 5.0)
Quarter year [message #575743] Sat, 26 January 2013 12:14 Go to next message
muqtadeer
Messages: 1
Registered: January 2013
Location: jeddah
Junior Member
Hello,
IF THE USER ENTER parameter for date(yymm) in a report as 201301

select vndr#,sum(net_sales_value) from mnthly_sales_value where vndr# = 111 and yymm = :yymm group by vndr#;

but I need result of 3 months, but in my table data is stored for one month so how to get 3 months then again 3 months so on for Q1,Q2,Q3,Q4

yymm between 201301 and 201303 and
yymm between 201304 and 201306 and
yymm between 201307 and 201309 and
yymm between 201310 and 201312
in the same query


what i have to do for this

Thanks
Re: Quarter year [message #575744 is a reply to message #575743] Sat, 26 January 2013 12:24 Go to previous messageGo to next message
BlackSwan
Messages: 22688
Registered: January 2009
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/
Re: Quarter year [message #575745 is a reply to message #575743] Sat, 26 January 2013 12:33 Go to previous messageGo to next message
Michel Cadot
Messages: 58856
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Welcome to the forum.
Your question is not understandable for someone that does not know the background. We know ONLY what you post us.

With any SQL or PL/SQL question, please, Post a working Test case: create table and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.

Before, Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" or "Preview Quick Reply" button to verify.
Also always post your Oracle version, with 4 decimals.

Regards
Michel
Re: Quarter year [message #575746 is a reply to message #575743] Sat, 26 January 2013 12:36 Go to previous message
Michel Cadot
Messages: 58856
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Or maybe this is what you mean:
SQL> select sysdate, trunc(sysdate,'Q') begin_quarter, 
  2         add_months(trunc(sysdate,'Q'),3)-1/86400 end_quarter
  3  from dual;
SYSDATE             BEGIN_QUARTER       END_QUARTER
------------------- ------------------- -------------------
26/01/2013 19:34:58 01/01/2013 00:00:00 31/03/2013 23:59:59

Replace sysdate by the date entered by the user using TO_DATE with a format (see Database SQL Reference).

Regards
Michel
Previous Topic: DBMS_JOBS failure check
Next Topic: BULK INSERT PERFORMANCE
Goto Forum:
  


Current Time: Thu Aug 21 21:41:18 CDT 2014

Total time taken to generate the page: 0.08494 seconds