ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 判断日期为今天与判断数据为空

判断日期为今天与判断数据为空

原创 Linux操作系统 作者:picyoung 时间:2008-01-24 13:14:45 0 删除 编辑

select

'今天采购了'+convert(varchar(8),count(*))+'份采购合同' as b_data

from xs_cg

where

b_orderdate=

convert(varchar(4),datepart(yy,getdate()))+'-'+convert(varchar(4),datepart(mm,getdate()))+'-'+convert(varchar(4),datepart(dd,getdate()))

declare @bdate datetime, @edate datetime

select

@bdate=convert(varchar(4),datepart(yy,getdate()))+'-'+convert(varchar(4),datepart(mm,getdate()))+'-'+convert(varchar(4),datepart(dd,getdate())),@edate=convert(varchar(4),datepart(yy,getdate()))+'-'+convert(varchar(4),datepart(mm,getdate()))+'-'+convert(varchar(4),datepart(dd,getdate())+3)

select

'三天之内采购合同'+convert(varchar(8),count(*))+'份' as b_data

 from xs_cg

where

b_deliverydate between @bdate and @edate 

select

'今天有'+convert(varchar(8),count(*))+'笔收汇.总金额是'+ convert(varchar(15),isnull(sum(b_amount),0))as b_data

from cw_skd

where 

b_date=

convert(varchar(4),datepart(yy,getdate()))+'-'+convert(varchar(4),datepart(mm,getdate()))+'-'+convert(varchar(4),datepart(dd,getdate()))

select
v_m_mailaddresssub.mx_user_id,
 v_m_mail.b_mailaddress,
count (case v_m_mail.b_state1 when ''ÊÕ'' THEN isnull(v_m_mail.b_customer_id,null) End) as RGB,
count (case v_m_mail.b_state1 when ''ÊÕ'' THEN isnull(v_m_mail.b_customer_id,'''') End )
-count(case v_m_mail.b_state1 when ''ÊÕ'' THEN isnull(v_m_mail.b_customer_id,null) End) as RNotGB,
count (case v_m_mail.b_state1 when ''ÊÕ'' THEN isnull(v_m_mail.b_customer_id,'''') End) as RTotal,
count (case when(v_m_mail.b_state2=''δ»Ø¸´'' and v_m_mail.b_state1=''ÊÕ'')THEN v_m_mail.b_id END) as NotRecMAIL,
count (case when(v_m_mail.b_state2=''Òѻظ´'' and v_m_mail.b_state1=''ÊÕ'')THEN v_m_mail.b_id END) as AlrRecMAIL,
count (case when(v_m_mail.b_state2=''ÒÑת·¢'' and v_m_mail.b_state1=''ÊÕ'')THEN v_m_mail.b_id END) as AlrTraMAIL,
count (case v_m_mail.b_state1 when ''·¢'' THEN isnull(v_m_mail.b_customer_id,null) End) as LGB,
count (case v_m_mail.b_state1 when ''·¢'' THEN isnull(v_m_mail.b_customer_id,'''') End)
-count (case v_m_mail.b_state1 when ''·¢'' THEN isnull(v_m_mail.b_customer_id,null) End) as LNotGB,
count (case v_m_mail.b_state1 when ''·¢'' THEN isnull(v_m_mail.b_customer_id,'''') End) as LTotal
from v_m_mailaddresssub
INNER JOIN v_m_mail ON  v_m_mail.b_mailaddress=v_m_mailaddresssub.father
 where 2>1
and v_m_mailaddresssub.mx_xh=1

    case Fitemid of
      1:sql.add('where b_state1=''ÊÕ'' and b_customer_id is not null and b_mailaddress=:b_mailaddress');
      2:sql.add('where b_state1=''ÊÕ'' and b_customer_id is null and b_mailaddress=:b_mailaddress');
      3:sql.add('where b_state1=''ÊÕ'' and b_mailaddress=:b_mailaddress');
      4:sql.add('where b_state2=''δ»Ø¸´'' and b_state1=''ÊÕ'' and b_mailaddress=:b_mailaddress');
      5:sql.add('where b_state2=''Òѻظ´'' and b_state1=''ÊÕ'' and b_mailaddress=:b_mailaddress');
      6:sql.add('where b_state1=''·¢'' and b_customer_id is not null and b_mailaddress=:b_mailaddress');
      7:sql.add('where b_state1=''·¢'' and b_customer_id is null and b_mailaddress=:b_mailaddress');
      8:sql.add('where b_state1=''·¢'' and b_mailaddress=:b_mailaddress');
      9:sql.add('where b_state2=''ÒÑת·¢'' and b_state1=''ÊÕ'' and b_mailaddress=:b_mailaddress');
    end;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12865448/viewspace-159278/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2008-01-24

  • 博文量
    1
  • 访问量
    1875