这是我的代码:
select column1, column2 from table1;
这是column1的预览:
1.1 Specimen Mislabeled
1.9 QNS- Specimen Spilled in transit
1.3 QNS-Quantity Not Sufficient
1.6 Test Requisition Missing
1.11 Other - Validity only
1.11 Other-reject per practice
1.5 Patient Info. entered Incorrectly
1.11 Other-Validity
1.11 Other-validity only
1.11 Other-Reject per agency
1.11 Other - not our req
1.11 Other - Not ML requisition
1.11 Other - Defective POC cups?
我希望它在1.11 Other
"*1.11 Other*"
另外一句话我希望sql语句的结果是:
1.1 Specimen Mislabeled
1.9 QNS- Specimen Spilled in transit
1.3 QNS-Quantity Not Sufficient
1.6 Test Requisition Missing
1.11 Other
1.11 Other
1.5 Patient Info. entered Incorrectly
1.11 Other
1.11 Other
1.11 Other
1.11 Other
1.11 Other
1.11 Other
我该怎么做?
答案 0 :(得分:2)
使用CASE声明;即。
SELECT
CASE WHEN Column1 LIKE '%1.11 Other%'
THEN '1.11 Other'
ELSE Column1 END AS Column1,
Column2
FROM
table1
答案 1 :(得分:1)
select column1 from table1 where column1 like '1.11 Other*'
它可能是%而不是*我在sql和access之间混淆了。但我认为这是*。虽然如果这不起作用尝试%。基本上你在结尾使用通配符,所以匹配开头和从通配符开始的任何东西。