'hzmat_no' = case
when SUBSTRING(miodt.vou_no, 1,1)='H'and miodt.mat_no=''then cutcurdt.mat_no
when SUBSTRING(miodt.vou_no, 1,1)='C' and miodt.mat_no='' then bultbj.mat_no else miodt.mat_no end
就是說,我在SQL語句中加了條件選擇,然后需要按'hzmat_no'加where條件.
when SUBSTRING(miodt.vou_no, 1,1)='H'and miodt.mat_no=''then cutcurdt.mat_no
when SUBSTRING(miodt.vou_no, 1,1)='C' and miodt.mat_no='' then bultbj.mat_no else miodt.mat_no end
就是說,我在SQL語句中加了條件選擇,然后需要按'hzmat_no'加where條件.
解决方案 »
- 大家小围观一下,一个简单的SQL问题
- 我已安装了Sql 企业版,过期了怎么办?改日期又可以用
- 100求解:从一个数据库在中的一个表插入到别一个数据库中的一个表中
- UNION ALL 是什么意思啊?
- 登录权限与数据表所有者之间的关系,请看问题。设计asp语句
- 俩个表内容并列显示,并排序,只有一个字段有关联,不是一对一的
- 各位老大,在windows 2003上怎么装不上sql2000,我没有带补丁的sql2000能先安装上吗?
- 为什么sql server 会自动回滚事务?
- 关于union取并集,解决问题立即给分,多谢
- 请问各位前辈有什么办法把DVD格式文件存储在SQL 中
- 这个存储过程错在那里?
- sql语句,头痛?难道要用游标?
select * from
(
select MIODT.* ,'hzmat_no' = case
when SUBSTRING(miodt.vou_no, 1,1)='H'and miodt.mat_no=''then cutcurdt.mat_no
when SUBSTRING(miodt.vou_no, 1,1)='C' and miodt.mat_no='' then bultbj.mat_no else miodt.mat_no end
from miodt
left join cutcurdt on miodt.vou_no=cutcurdt.vou_no and miodt.part_no=cutcurdt.part_no
left join bultbj on miodt.vou_no=bultbj.bul_no and miodt.part_no=bultbj.part_no ) a
WHERE hzmat_no='A01010902'
select * from
(
select MIODT.* ,'hzmat_no' = case
when SUBSTRING(miodt.vou_no, 1,1)='H'and miodt.mat_no=''then cutcurdt.mat_no
when SUBSTRING(miodt.vou_no, 1,1)='C' and miodt.mat_no='' then bultbj.mat_no else miodt.mat_no end
from miodt
left join cutcurdt on miodt.vou_no=cutcurdt.vou_no and miodt.part_no=cutcurdt.part_no
left join bultbj on miodt.vou_no=bultbj.bul_no and miodt.part_no=bultbj.part_no ) a
WHERE hzmat_no='A01010902'