MySQL RLIKE缺少信息

时间:2014-08-05 18:35:54

标签: mysql

SELECT * FROM A, B, C, D WHERE A = 1 AND B RLIKE '^[0-9]'

上面的命令将收集A = 1和B中的数据,从0到9开始。例如,它将收集111,112,113,114等。但是,上面的命令总是会丢失一些数据,相比之下将它分成RLIKE' ^ [0]',RLIKE'^ [1]'等,如下所示。

SELECT * FROM A, B, C, D WHERE A = 1 AND B RLIKE '^[0]'
SELECT * FROM A, B, C, D WHERE A = 1 AND B RLIKE '^[1]'
SELECT * FROM A, B, C, D WHERE A = 1 AND B RLIKE '^[2]'
SELECT * FROM A, B, C, D WHERE A = 1 AND B RLIKE '^[3]'
SELECT * FROM A, B, C, D WHERE A = 1 AND B RLIKE '^[4]'
SELECT * FROM A, B, C, D WHERE A = 1 AND B RLIKE '^[5]'
SELECT * FROM A, B, C, D WHERE A = 1 AND B RLIKE '^[6]'
SELECT * FROM A, B, C, D WHERE A = 1 AND B RLIKE '^[7]'
SELECT * FROM A, B, C, D WHERE A = 1 AND B RLIKE '^[8]'
SELECT * FROM A, B, C, D WHERE A = 1 AND B RLIKE '^[9]'

在上面的例子中,

SELECT * FROM A, B, C, D WHERE A = 1 AND B RLIKE '^[1]'

它将始终收集111,112,113,114,115,121,其中“115”和“121”是额外的“SELECT * FROM A,B,C,D WHERE A = 1 AND B RLIKE'^ [0-9]'”无法看到。使用REGEXP将具有相同的结果。我可以知道是否有任何评论?谢谢。

We are using MySQL 5.1.39.   

1 个答案:

答案 0 :(得分:0)

不应该有区别。你能给我一个确切的查询吗?上述查询格式错误,难以置之的原因115& 121没有被选中。