postresql:如何在where语句中输入多个范围

mitkmikd  于 2021-07-26  发布在  Java
关注(0)|答案(2)|浏览(295)
  1. select *
  2. from chartname
  3. where itemvalue ~'^[A-Z]'

我还想包括[a-z],所以我尝试了以下方法:

  1. select *
  2. from chartname
  3. where itemvalue ~'^[A-Z]' or ~'^[a-z]'

  1. select *
  2. from chartname
  3. where itemvalue ~'^[A-Z]' and ~'^[a-z]'

但这似乎不管用

8ulbf1ek

8ulbf1ek1#

如果满足以下条件,则第一个查询可以工作:

  1. where itemvalue ~'^[A-Z]' or itemvalue ~'^[a-z]'

但这里有一个更好的方法:

  1. select *
  2. from chartname
  3. where itemvalue ~'^[aA-zZ]'
xfyts7mz

xfyts7mz2#

我怀疑你想要:
其中itemvalue ~'^[a-za-z]'
这是以52个罗马字母中的一个开始的任何值。

相关问题