【发布时间】:2019-02-09 20:47:33
【问题描述】:
我有一个查询将字符串值与数据库中的名称字段进行比较。 DB中name字段的结构不一致,可以是以下任意一种:
John Doe
Doe John
Doe, John
我的字符串值可以是任何结构,但现在是这样的:
Doe, John
查询:
full_name ILIKE 'Doe, John%'
这并不总是返回记录。在任何结构中进行比较最可靠的查询是什么?
【问题讨论】:
-
full_name in ('John Doe', 'Doe John', 'Doe, John')
标签: sql string postgresql where-clause sql-like