需要Oracle查询帮助

时间:2013-05-21 13:27:09

标签: oracle

在执行以下查询后,我们将错过几天现在我想添加额外的过滤器,如果以下查询的任何显示日期是星期六和星期日它必须删除那些日期所以不应该显示这些日期可以任何人都指导我如何在以下查询中扩展此过滤器.. 我从这个论坛获得以下查询,但随着这个查询,我需要一些查询,这将满足我上述问题。请帮我修改这个查询

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;  

1 个答案:

答案 0 :(得分:0)

添加条件:

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

- 到你的where条款。