1

在执行以下查询后,我们将丢失天数现在我想添加额外的过滤器,即如果以下查询的任何显示日期是星期六和星期日,则必须删除这些日期,因此不应显示这些日期,谁能指导我如何在下面的查询中扩展这个过滤器。下面的查询是我从这个论坛得到的,但是除了这个查询之外,我还需要一些能够满足我上述问题的查询。请帮助我如何修改此查询

with date_range as (
  select min(the_date) as oldest, 
         max(the_date) as recent, 
         max(the_date) - min(the_date) as total_days
  from your_table
 ),
  all_dates as (
   select oldest + level - 1 as a_date
   from date_range
   connect by level <= (select total_days from date_range)
   )
   select ad.a_date
   from all_dates ad
   left join your_table yt on ad.a_date = yt.the_date
   where yt.the_date is null
   order by ad.a_date;  
4

1 回答 1

0

添加条件:

and to_char(ad.a_date, 'Dy') not in ('Sat','Sun')

- 你的where条款。

于 2013-05-21T13:38:30.703 回答