0

I have a record in my table (table1) whose name is "Jonh Wood Doe Smith" and I want to return it even if the user types any of the possible combinations: "John Doe", "Jonn Wood Smith", etc

I implemented a collumn (fullName) which is an array with all the names and was thinking to search it like:

SELECT * FROM table1 WHERE ({"Wood","Doe"}) IN ANY (fullName)

Do you know if this is possible and/or what is the best approach to this kind of problem? I will use postgresql so proprietary methods, functions, etc is not a problem. It doesn't need to be a method compatible with other DBs.

Note: fullName is a collumn like this {"John", "Wood", "Doe", "Smith"}

4

1 回答 1

1

您应该像这样使用数组运算符<@

SELECT * FROM users WHERE array['Wood','Doe'] <@ fullname;

小提琴

但你真正应该做的是对全文搜索感兴趣

于 2013-08-03T11:14:20.947 回答