Thread: SQL substring

SQL substring

From
"Guy Korland"
Date:
Hi,
How can I compare two fields if one is a substring of the other?
Something like: ... WHERE StringA like '%' + StringB + '%';

Thanks,
Guy Korland



Re: SQL substring

From
Franco Bruno Borghesi
Date:
... WHERE field1 LIKE '%' || field2 || '%'<br /> or<br /> ... WHERE position(field2 in field1)>0<br /><br /> On
Wed,2003-11-12 at 11:07, Guy Korland wrote: <blockquote type="CITE"><pre><font color="#737373"><i>Hi, 
How can I compare two fields if one is a substring of the other?
Something like: ... WHERE StringA like '%' + StringB + '%';

Thanks,
Guy Korland


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
</i></font></pre></blockquote>

Re: SQL substring

From
Bruno Wolff III
Date:
On Wed, Nov 12, 2003 at 11:38:31 -0300, Franco Bruno Borghesi <franco@akyasociados.com.ar> wrote:
> ... WHERE field1 LIKE '%' || field2 || '%'

The first way won't work correctly if field2 has %s in it.

> or
> ... WHERE position(field2 in field1)>0