执行此操作的最佳方法是什么?
select * from myTable where hostname IN ('host1-%', 'host2-%', 'host3-%')
主机名有时返回为完全限定域或简单如 host1
最佳答案
这是你想要的吗
select * from myTable where hostname REGEXP '^host[123]-'
或
select * from myTable where hostname REGEXP '^host[1-3]-'
关于mysql where IN 语句使用正则表达式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40512192/