我想在十二月份拉出三天,即11,12和15,我不想要13日和14日的数据。我没有任何方式可以做到这一点而没有" write-Access"设置日期。
这是我的查询无效。
select distinct fill_sold_dt,sum(fill_qty_dspn) as Pills, sum((fill_qty_dspn)/(pkg_sz*pkg_qty) ) as Packs
from
prdedwvwh.prescription_fill_sold pf, prdedwvwh.location_store_address_cur lsa, prdedwvwh.drug_cur d
where pf.str_nbr=lsa.str_nbr and
d.drug_id=pf.drug_id
and ((fill_sold_dt(dw,'2014-12-09') + @@DATEFIRST) % 7) NOT IN (5, 6)
and wic_nbr in (683378,335776,418723)
group by fill_sold_dt
答案 0 :(得分:0)
尝试使用这样的条件(your_date是日期类型):
.. where to_char(your_date,'d','NLS_DATE_LANGUAGE=ENGLISH') not in (1,7);
除了周末外,这给你所有的日子。
没有NLS_SETTINGS:
.. where TRUNC (your_date) - TRUNC (your_date, 'IW') + 1 not in (1,7);
答案 1 :(得分:0)
由于我无法完全取消SQL Server查询,因此这里有一个显示类似构造的SQLFiddle示例:
create table test1 ( fill_sold_dt date, stuff number(10) );
insert into test1 values('11-DEC-2014',1);
insert into test1 values('12-DEC-2014',2);
insert into test1 values('13-DEC-2014',3);
insert into test1 values('14-DEC-2014',4);
insert into test1 values('15-DEC-2014',5);
insert into test1 values('16-DEC-2014',6);
select *
from test1
where to_char(fill_sold_dt,'DY') not in ('SAT','SUN');