Home » SQL & PL/SQL » SQL & PL/SQL » Group by on date (Oracle 10)
Group by on date [message #395877] Thu, 02 April 2009 23:53 Go to next message
nsa_tanay
Messages: 2
Registered: April 2009
Location: Kolkata
Junior Member
I have the table details in the attached file.
The o/p should be something like:--

Date_range :)  :)  :) 			Total_Cust_Complaint
2005-01-01 to 2005-03-31(Q1) :)  :) 		23 
2005-04-01 to 2005-07-31(Q2) :)  :) 		50
........................(Q3) :)  :) 		..
........................(Q4) :)  :) 		..

That is I have to count the the costomer complaints for each quarter.
--------------------------------------------------------

I am not able to do this. Can some body help write the SQL please.

[added code tags to remove smilies]
  • Attachment: Table.txt
    (Size: 0.53KB, Downloaded 105 times)

[Updated on: Fri, 03 April 2009 04:44] by Moderator

Report message to a moderator

Re: Group by on date [message #395878 is a reply to message #395877] Thu, 02 April 2009 23:55 Go to previous messageGo to next message
BlackSwan
Messages: 25041
Registered: January 2009
Location: SoCal
Senior Member
stop spamming this forum!
Re: Group by on date [message #395880 is a reply to message #395878] Thu, 02 April 2009 23:58 Go to previous messageGo to next message
nsa_tanay
Messages: 2
Registered: April 2009
Location: Kolkata
Junior Member
I am extremely sorry. I clicked 'create post' several times as I was not getting any response from the browser.
Re: Group by on date [message #395882 is a reply to message #395880] Fri, 03 April 2009 00:01 Go to previous messageGo to next message
bonker
Messages: 402
Registered: July 2005
Senior Member
how about
select count(*) cnt,trunc(complaint_register_dt,'Q')
from <<tablename>>
group by trunc(complaint_register_dt,'Q')

Re: Group by on date [message #395883 is a reply to message #395877] Fri, 03 April 2009 00:02 Go to previous messageGo to next message
BlackSwan
Messages: 25041
Registered: January 2009
Location: SoCal
Senior Member
You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
Please, please, please Read & Follow Posting Guidelines above.
Go to the section labeled "Practice" & do as directed.
Re: Group by on date [message #395899 is a reply to message #395877] Fri, 03 April 2009 00:36 Go to previous message
Michel Cadot
Messages: 64120
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
nsa_tanay wrote on Fri, 03 April 2009 06:53
I have the table details in the attached file.
The o/p should be something like:--

Date_range Smile Smile Smile Total_Cust_Complaint
2005-01-01 to 2005-03-31(Q1) Smile Smile 23
2005-04-01 to 2005-07-31(Q2) Smile Smile 50
........................(Q3) Smile Smile ..
........................(Q4) Smile Smile ..

That is I have to count the the costomer complaints for each quarter.
--------------------------------------------------------

I am not able to do this. Can some body help write the SQL please.

I doubt SQL*Plus can output smileys.
Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Use code tags and align the columns in result.
Use the "Preview Message" button to verify.

Regards
Michel

Previous Topic: Building the string having n no of '&' occurrences.
Next Topic: to calculate the sum of time
Goto Forum:
  


Current Time: Tue Dec 06 14:06:36 CST 2016

Total time taken to generate the page: 0.15594 seconds