1
不熟悉SQL並且正在開發查詢過程中,使用ETL過程的複製部分。Select Case查詢不起作用
賬單code1 = bf,然後設置爲債務代碼1.如果結算字段(債務代碼)超過100個字符,則添加'*'作爲前綴。
但是查詢會下降,因爲計費代碼1 = bf將單個結果集返回到返回大型結果集的債務代碼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
想法歡迎。
哪些DBMS您使用這個給你一些想法? –
爲什麼你不能在子查詢中使用'WHERE'子句? – JNK
SQL服務器會考慮使用where子句。 – Nobody