[英]Select Case query not working
SQL的新成员,并且在开发查询的过程中,具有复制ETL过程的一部分。
然后,将帐单代码1 = bf设置为债务代码1。如果帐单字段(债务代码)超过100个字符,则添加“ *”作为前缀。
但是,查询将下降,因为帐单代码1 = bf将单个结果集返回到债务代码1,该债务代码1将返回大结果集。
select
case when len(format) > 100 then left(format, 100) + '*'
else format end as format
from (select case when exists (select _hs_eb_code1 from hbl_cat where hs_eb_code = 'bf)
then tbm_bllgrp._hs_eb_det1 end) as format
from tbm_bllgrp
想法欢迎。
select
case when len(format) > 100 then left(format, 100) + '*'
else format end as format
from tbm_bllgrp b
inner join hbl_cat hc on hc._hs_eb_code1 = b._hs_eb_det1
这只是一个猜测,因为我没有确切的架构和预期的输出,但是我希望这会给您一些想法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.