marmar
marmar

Reputation: 113

Skipping sunday in oracle days difference

I want to query an sql to select days remaining but neglecting sundays, so far I have this

select to_date(due_date) - trunc(sysdate) 
from project 
where project_name = 'SUPPERHOUSE'

and how to ignore sunday occurences ?

thanks

Upvotes: 0

Views: 73

Answers (1)

mucio
mucio

Reputation: 7119

In the past I used a query like this:

select TRUNC (sysdate) - TRUNC (due_date) -1 *  (to_char(sysdate, 'WW') - to_char(due_date, 'WW')) solution
  from project
where project_name = 'SUPPERHOUSE'

You can check this SQLFiddle demo.

Upvotes: 2

Related Questions