Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
MY EXTRACTION IS RANGE BETWEEN TWO DATES IN THAT EXCLUDE SUNDAY DATE ONLY HOW TO PROCEED IN SQL
Posted
Comments
Jörgen Andersson 1-Sep-15 2:39am    
Oh, by the way. Using all capitals is considered to be shouting and is bad form.

To get the day of the week you can use To_Char(MyDateColumn,'D').
It will give you a number from 1 to 7 where 1 is Monday and 7 is Sunday.
So if you run
SQL
Select  *
FROM    MyTable
WHERE   To_Char(MyDateColumn,'D') != 7
You will have excluded Sundays from your query.

Just keep in mind that using functions in the WHERE clause is bad for performance. So it would be preferred if you can use the function in the SELECT clause instead.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900