【问题标题】:Filtering the data with certain keywords from the query digit postgresql从查询数字postgresql中过滤带有某些关键字的数据
【发布时间】:2017-02-28 17:15:36
【问题描述】:

当我使用 Like '%007%' 时,我会查找数据位数为 007,而不是位数为 007 的很多数据。如何找到数字上只有 007 到 4 到 6 位的数据?谢谢。

【问题讨论】:

  • 什么是“数字到四”?
  • 从第四位到第六位。对不起,我的英语不好:)
  • 那么,比如substring('002007914050529' from 4 for 3) = '007'?

标签: jquery postgresql filtering


【解决方案1】:

如果您使用like 运算符并且知道确切位置,请在开头使用三个 udscore:

t=# select '12300789' like '___007%';
 ?column?
----------
 t
(1 row)

t=# select '12340789' like '___007%';
 ?column?
----------
 f
(1 row)

【讨论】:

    猜你喜欢
    • 2019-10-09
    • 1970-01-01
    • 2021-01-05
    • 1970-01-01
    • 1970-01-01
    • 2018-12-08
    • 2020-12-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多