Home » SQL & PL/SQL » SQL & PL/SQL » Except Friday Query
Except Friday Query [message #430086] Sun, 08 November 2009 02:34 Go to next message
mmsalman87
Messages: 41
Registered: September 2009
Location: kuwait
Member
hi all
i am trying to write query that discount the number of friday days between two days How ?

example
from_date = 21/10/2009
to_date = 2/11/2009

the result should be
(to_date - from_date ) - number of friday days between two days



thanks in advanced
Re: Except Friday Query [message #430087 is a reply to message #430086] Sun, 08 November 2009 02:43 Go to previous messageGo to next message
seyed456
Messages: 220
Registered: May 2008
Location: south india .
Senior Member

http://www.orafaq.com/forum/m/23332/124185/?srch=number+of+fridays#msg_23332

http://www.orafaq.com/forum/m/21144/124185/?srch=number+of+fridays#msg_21144

Take a look above..


Thanks
Seyed
Re: Except Friday Query [message #430088 is a reply to message #430086] Sun, 08 November 2009 02:49 Go to previous messageGo to next message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
You have to know that we don't do homework for you.
You have to post what you already tried.
Use SQL*Plus and post it, before 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.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.

Regards
Michel
Re: Except Friday Query [message #430099 is a reply to message #430086] Sun, 08 November 2009 05:56 Go to previous messageGo to next message
mamalik
Messages: 270
Registered: November 2008
Location: Pakistan
Senior Member

Dear
Try This Query,
Select Count(*) From(
Select To_Char(Frm_Dte+Rownum-1,'Day') D
From (
     Select 1 From Dual Group By Cube(1,2,3,4,5,6))
Where Rownum<=(Too_Dte-Frm_Dte)+1)
Where D!='FRIDAY'



Regards.
Muhammad Asif.
Re: Except Friday Query [message #430107 is a reply to message #430099] Sun, 08 November 2009 06:50 Go to previous messageGo to next message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Very old row generator, you should upgrade your knowledge and read Row generator

Also you should read and follow OraFAQ guide that stated that you MUST NOT give solution to homework just hint.

Regards
Michel

[Updated on: Sun, 08 November 2009 06:51]

Report message to a moderator

Re: Except Friday Query [message #430127 is a reply to message #430086] Mon, 09 November 2009 00:28 Go to previous messageGo to next message
maher534510
Messages: 25
Registered: September 2008
Location: jordan
Junior Member
thanks all
no thing of your posts solve my problem
Re: Except Friday Query [message #430129 is a reply to message #430127] Mon, 09 November 2009 00:46 Go to previous messageGo to next message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:
no thing of your posts solve my problem

What does this mean?

Regards
Michel
Re: Except Friday Query [message #430133 is a reply to message #430127] Mon, 09 November 2009 01:14 Go to previous messageGo to next message
ramoradba
Messages: 2457
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
Before posting..like the below...
Quote:
thanks all
no thing of your posts solve my problem

post your sql session here...And letus know whats your requirement....
Say like given date is "friday" then result should include that or not... format your post Like the below...

SQL> ED
Wrote file afiedt.buf

  1  Select Count(*) From(
  2  Select To_Char(to_date('21-OCT-09','DD-MON-YY')+Rownum-1,'Day') D
  3  From (
  4       Select 1 From Dual Group By Cube(1,2,3,4,5,6))
  5  Where Rownum<=(to_date('02-NOV-09','DD-MON-YY')-to_date('21-OCT-09','DD-MON-YY'))+1)
  6* Where D!='FRIDAY'
SQL> /

  COUNT(*)
----------
        13

This will help you

http://asktom.oracle.com/pls/asktom/f?p=100:11:504503837393551::::P11_QUESTION_ID:185012348071

Sriram.
Re: Except Friday Query [message #430135 is a reply to message #430133] Mon, 09 November 2009 01:48 Go to previous messageGo to next message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Michel Cadot wrote on Sun, 08 November 2009 13:50
Very old row generator, you should upgrade your knowledge and read Row generator
...

SQL> select to_char(sysdate,'Day') from dual;
TO_CHAR(S
---------
Monday

1 row selected.

Regards
Michel
Re: Except Friday Query [message #430139 is a reply to message #430135] Mon, 09 November 2009 02:08 Go to previous message
ramoradba
Messages: 2457
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
Michel Cadot wrote on Mon, 09 November 2009 01:48
Michel Cadot wrote on Sun, 08 November 2009 13:50
Very old row generator, you should upgrade your knowledge and read Row generator
...

SQL> select to_char(sysdate,'Day') from dual;
TO_CHAR(S
---------
Monday

1 row selected.

Regards
Michel




i didn`t specify any answer there...I just given him/her a hint that how to post the code. i specified my answer By giving a URL..

i used the same query of previous reply...As he/she said Quote:
thanks all
no thing of your posts solve my problem
.

Hope you got My point...

Thank you
sriram. Smile

Previous Topic: Print command blank line (merged)
Next Topic: Help In tuning but facing "Not Group By expression error"
Goto Forum:
  


Current Time: Thu Feb 06 16:13:03 CST 2025