English 中文(简体)
选择一封信的范围(邮政管理处)
原标题:Select where first letter in a range ( PostgreSQL )
  • 时间:2011-11-10 20:11:21
  •  标签:
  • postgresql

我正试图从一封信一字的一张桌上挑选(例如a-f)

我尝试了这样的条款:

WHERE 下调(第一版)

我希望,我会找到一种办法,在较后动态地产生ARRAY的范围。

以上所述并不可行。 任何想法,我会错做什么?

最佳回答

http://www.postgresql.org/docs/8.3/static/Functions-matching.html。 SIMILAR TO keyword. 下面列出所有标题,从一、k或t开始。

... WHERE lower(title) SIMILAR TO  (a|k|t)% 

If you want to use a range, you could use the [] notation:

... WHERE lower(title) SIMILAR TO  [a-f]% 

<>0>

  1. <>%>>>> > 代码/代码”的特性与格式相应的任何特性。 例如,第二种模式的范例是:bc、ab、a、w、w、恐惧等。

  2. 此外,必须指出<代码>。 SIMILAR TO keyword is only available to PostgreSL and it is not ANSIQ.

  3. 最后,在使用特性类别时,不需要<代码>底线(标题)。 你们只能寻找像样的东西。

    www.un.org/spanish/ecosoc

问题回答

你不理解右边的阵列,希望<代码>= ANY:

WHERE lower(substring(title from 1 for 1)) = ANY (ARRAY[ a ,  k ,  t ])

<http://www.postgresql.org/docs/ 当前/static/Functions-matching.html#FUNCTIONS-LIKE"rel=“noretinger”>LIKE,

引文:





相关问题
摘录数据

我如何将Excel板的数据输入我的Django应用? I m将PosgreSQL数据库作为数据库。

Postgres dump of only parts of tables for a dev snapshot

On production our database is a few hundred gigabytes in size. For development and testing, we need to create snapshots of this database that are functionally equivalent, but which are only 10 or 20 ...

How to join attributes in sql select statement?

I want to join few attributes in select statement as one for example select id, (name + + surname + + age) as info from users this doesn t work, how to do it? I m using postgreSQL.

What text encoding to use?

I need to setup my PostgreSQL DB s text encoding to handle non-American English characters that you d find showing up in languages such as German, Spanish, and French. What character encoding should ...

SQL LIKE condition to check for integer?

I am using a set of SQL LIKE conditions to go through the alphabet and list all items beginning with the appropriate letter, e.g. to get all books where the title starts with the letter "A": SELECT * ...

热门标签