From: | Edoardo Panfili <edoardo(at)aspix(dot)it> |
---|---|
To: | A B <gentosaker(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Textmatchning |
Date: | 2008-09-17 20:12:36 |
Message-ID: | 13399888.4901221682359057.JavaMail.root@vnr.agr.unipg.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
A B ha scritto:
> Hi.
> I would like to compare two columns a and b and find all cases where
> a is a part of b, like this
> select * from mytable where a ilike b;
>
> but that will not give me a row in the case when a = 'foo' and b='FOOTBALL'
> and I want that to be a match.
>
> So how do I rewrite my expression? I can't find any way to add % to
> make it match the way I want.
It seems that the order is important.
http://www.postgresql.org/docs/8.3/interactive/functions-matching.html#FUNCTIONS-LIKE
select 'foo%' ilike 'FOOTBALL';
----------
f
but
select 'FOOTBALL' ilike 'foo%';
----------
t
Edoardo
From | Date | Subject | |
---|---|---|---|
Next Message | Erik Jones | 2008-09-17 20:36:15 | Re: Backend timeout |
Previous Message | Scott Marlowe | 2008-09-17 20:09:42 | Re: Textmatchning |