求助ing,sql语句报错,
select p.part_no as po ,p.in_Client as ref_id,convert(char(10), h.ok_date,20) as date_io,
datediff(day,h.ok_date,getdate() ) as days ,case when datediff(day,h.ok_date,getdate() ) then p.pn_in_stock else 0 end as Over_days From msh_in_part p,msh_in_head h
where p.pro_id=h.pro_id and h.in_job_id=p.in_job_id and h.in_ok= 'Y'
and p.pn_in_stock > 0 and datediff(day,h.ok_date,getdate() )
执行之后报‘消息 156,级别 15,状态 1,第 1 行
在关键字 'then' 附近有语法错误。’
各位帮忙看看了,case when .....then语句到底哪里用错 了,谢谢了...
datediff(day,h.ok_date,getdate() ) as days ,case when datediff(day,h.ok_date,getdate() ) then p.pn_in_stock else 0 end as Over_days From msh_in_part p,msh_in_head h
where p.pro_id=h.pro_id and h.in_job_id=p.in_job_id and h.in_ok= 'Y'
and p.pn_in_stock > 0 and datediff(day,h.ok_date,getdate() )
执行之后报‘消息 156,级别 15,状态 1,第 1 行
在关键字 'then' 附近有语法错误。’
各位帮忙看看了,case when .....then语句到底哪里用错 了,谢谢了...
作者: yxhit 发布时间: 2011-06-14
in_stock else 0 end as ?
else()?这是什么
else()?这是什么
作者: lkkkevin 发布时间: 2011-06-14
中英文是否正确,还有把逗号去掉测试测试会出什么错,括号也可以的! 只要你保证你写的没问题!
作者: wangshiyang 发布时间: 2011-06-14