简体   繁体   English

Select语句返回一个结果,其中文本字符仅包含0或9s,但长度无关紧要

[英]Select Statement that returns a result where the text characters contains only 0s or only 9s but length doesn't matter

I'm trying to write a select statement that returns column A when column B contains '0' or '9' or '00' or '99' or '000' or '999' and so forth. 我正在尝试编写一个select语句,当B列包含“ 0”或“ 9”或“ 00”或“ 99”或“ 000”或“ 999”等时,返回A列。 The values are TEXT. 值为TEXT。 Any help is appreciated! 任何帮助表示赞赏!

You could use: 您可以使用:

SELECT colA
FROM tab
WHERE REPLACE(colB, '9', '') = ''
   OR REPLACE(colB, '0', '') = '';

DBFiddle Demo DBFiddle演示

SELECT * FROM选项卡WHERE像'%9%'或像'%0%'的列

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM