SQL截取字符串
发布网友
发布时间:2022-04-10 02:45
我来回答
共2个回答
热心网友
时间:2022-04-10 04:15
select WBOOK_NO =
case when WBOOK_NO like '%H%' and WBOOK_NO not like '%HW%' then SUBSTRING(WBOOK_NO,7,9)
when WBOOK_NO like 'H%' and then SUBSTRING(WBOOK_NO,8,9) end,
WBOOK_NO
from EMS_PDE_HEAD WHERE WBOOK_NO='H3001720130823003698' OR WBOOK_NO='HW300172012048035872'
LIKE 'H%'时再and NOT LIKE 'HW%'就好啦
热心网友
时间:2022-04-10 05:33
select WBOOK_NO = case when WBOOK_NO like '%H%' then SUBSTRING(WBOOK_NO,7,9)
when WBOOK_NO like 'W%'then SUBSTRING(WBOOK_NO,8,9) else WBOOK_no end,--注意else语句
WBOOK_NO
from EMS_PDE_HEAD WHERE WBOOK_NO='H3001720130823003698' OR WBOOK_NO='HW300172012048035872'
or WBOOK_NO='201001780'