Обсуждение: LIKE upper('%$info%') -- (like google)

Поиск
Список
Период
Сортировка

LIKE upper('%$info%') -- (like google)

От
Patrick Coulombe
Дата:
how can i search my database like a search engine (ie google).

-- $info= patrick coulombe
-- select distinct * from friends where upper(name) LIKE upper('%$info%')

i want postgresql to find :

-- patrick lefevre
-- coulombe caroline
-- patrick coulombe
-- coulombe patrick

you get the idea...
thank you :)
patrick





Re: LIKE upper('%$info%') -- (like google)

От
Johan Daine
Дата:
Patrick Coulombe wrote:

> how can i search my database like a search engine (ie google).
>
> -- $info= patrick coulombe
> -- select distinct * from friends where upper(name) LIKE upper('%$info%')
>
> i want postgresql to find :
>
> -- patrick lefevre
> -- coulombe caroline
> -- patrick coulombe
> -- coulombe patrick
>
> you get the idea...
> thank you :)
> patrick
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

You might have a look at the regular expressions:
http://postgresql.mirror.easynet.be/users-lounge/docs/7.1/user/functions-matching.html#FUNCTIONS-REGEXP

http://www.opengroup.org/onlinepubs/7908799/xbd/re.html

Good luck
--
           _/    /_/_/_/            Johan Daine
          _/    /_/    _/           mailto:isis@wanadoo.be
         _/    /_/    _/            http://thot.dyndns.org:6080
        _/    /_/    _/
       _/    /_/    _/
 /_/_/_/    /_/_/_/



Re: LIKE upper('%$info%') -- (like google)

От
Johan Daine
Дата:
Patrick Coulombe wrote:

> how can i search my database like a search engine (ie google).
>
> -- $info= patrick coulombe
> -- select distinct * from friends where upper(name) LIKE upper('%$info%')
>
> i want postgresql to find :
>
> -- patrick lefevre
> -- coulombe caroline
> -- patrick coulombe
> -- coulombe patrick
>
> you get the idea...
> thank you :)
> patrick
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>

Try something lile
 select  *  from friends where name  ~*  '(Patrick)|(Coulombe)' ;

>
> http://www.postgresql.org/users-lounge/docs/faq.html

--
           _/    /_/_/_/            Johan Daine
          _/    /_/    _/           mailto:isis@wanadoo.be
         _/    /_/    _/            http://thot.dyndns.org:6080
        _/    /_/    _/
       _/    /_/    _/
 /_/_/_/    /_/_/_/