pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedSQL substring
4+ messages / 3 participants
[nested] [flat]
* SQL substring
@ 2003-11-12 13:44 Guy Korland <korland@cs.Technion.AC.IL>
2003-11-12 14:07 ` SQL substring Guy Korland <korland@cs.Technion.AC.IL>
0 siblings, 1 reply; 4+ messages in thread
From: Guy Korland @ 2003-11-12 13:44 UTC (permalink / raw)
To: pgsql-sql
Hi,
How can I compare two fields if one is a substring of the other?
Something like:
... WHERE StringA like '%' + StringB + '%';
Thanks,
Guy Korland
^ permalink raw reply [nested|flat] 4+ messages in thread
* SQL substring
2003-11-12 13:44 SQL substring Guy Korland <korland@cs.Technion.AC.IL>
@ 2003-11-12 14:07 ` Guy Korland <korland@cs.Technion.AC.IL>
2003-11-12 14:38 ` Re: SQL substring Franco Bruno Borghesi <franco@akyasociados.com.ar>
0 siblings, 1 reply; 4+ messages in thread
From: Guy Korland @ 2003-11-12 14:07 UTC (permalink / raw)
To: pgsql-sql
Hi,
How can I compare two fields if one is a substring of the other?
Something like:
... WHERE StringA like '%' + StringB + '%';
Thanks,
Guy Korland
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: SQL substring
2003-11-12 13:44 SQL substring Guy Korland <korland@cs.Technion.AC.IL>
2003-11-12 14:07 ` SQL substring Guy Korland <korland@cs.Technion.AC.IL>
@ 2003-11-12 14:38 ` Franco Bruno Borghesi <franco@akyasociados.com.ar>
2003-11-12 15:13 ` Re: SQL substring Bruno Wolff III <bruno@wolff.to>
0 siblings, 1 reply; 4+ messages in thread
From: Franco Bruno Borghesi @ 2003-11-12 14:38 UTC (permalink / raw)
To: Guy Korland <korland@cs.Technion.AC.IL>; +Cc: pgsql-sql
... WHERE field1 LIKE '%' || field2 || '%'
or
... WHERE position(field2 in field1)>0
On Wed, 2003-11-12 at 11:07, Guy Korland wrote:
> 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
>
Attachments:
signature.asc (application/pgp-signature, 186B) download
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: SQL substring
2003-11-12 13:44 SQL substring Guy Korland <korland@cs.Technion.AC.IL>
2003-11-12 14:07 ` SQL substring Guy Korland <korland@cs.Technion.AC.IL>
2003-11-12 14:38 ` Re: SQL substring Franco Bruno Borghesi <franco@akyasociados.com.ar>
@ 2003-11-12 15:13 ` Bruno Wolff III <bruno@wolff.to>
0 siblings, 0 replies; 4+ messages in thread
From: Bruno Wolff III @ 2003-11-12 15:13 UTC (permalink / raw)
To: Franco Bruno Borghesi <franco@akyasociados.com.ar>; +Cc: Guy Korland <korland@cs.Technion.AC.IL>; pgsql-sql
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
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2003-11-12 15:13 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-11-12 13:44 SQL substring Guy Korland <korland@cs.Technion.AC.IL>
2003-11-12 14:07 ` Guy Korland <korland@cs.Technion.AC.IL>
2003-11-12 14:38 ` Franco Bruno Borghesi <franco@akyasociados.com.ar>
2003-11-12 15:13 ` Bruno Wolff III <bruno@wolff.to>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox