我因为一个相对微不足道的问题而停滞不前. 这样一个简单的查询:
select distinct field_name,length(field_name) from table_a where
field_name similar to `2\[0-9\]\[0-9\]%`;
返回以下行:
field_name|length|
----------+------+
200 | 3|
203 | 3|
210 | 3|
但与此非常相似的是,其中只省略了表达式中的‘%’,不返回任何行:
select distinct field_name,length(field_name) from table_a where
field_name similar to '[23][0-9][0-2]';
field_name
列被定义为CHAR(10)
.
问题可能是由于字段末尾的一些字符造成的,但我不知道如何消除它们.
你介意告诉我怎么解吗?
查阅了PostgreSQL文档和教程, 在谷歌上搜索,Stackoverflow没有成功.