Re: [SQL] Finding strings inside a field... - Mailing list pgsql-sql

From Tim J Trowbridge
Subject Re: [SQL] Finding strings inside a field...
Date
Msg-id 199806292139.QAA20652@earth.execpc.com
Whole thread Raw
In response to Finding strings inside a field...  (Dan Delaney <dionysos@dionysia.org>)
List pgsql-sql
Dan Delaney wrote:
>
> Hello all.
>    Could any one tell me if the following is possible using
> PostgreSQL?
>
> I want to be able do a SELECT and search for a string INSIDE OF a
> field. So, say I want to get all record in testtable which contain
> the word "foobar" inside the "description" attribute. The following
> will only get those records in which the "description" attribute
> contains ONLY the word "foobar":
>
> SELECT FROM testtable WHERE description='foobar';

Try this:

SELECT FROM testtable WHERE description like '%foobar%';

Note that this isn't case insensitive.



--
Tim J Trowbridge                         trowbrid@writeme.com
Interested in my genealogy?          http://www.execpc.com/~trowbrid

pgsql-sql by date:

Previous
From: Dan Delaney
Date:
Subject: Finding strings inside a field...
Next
From: "Brett W. McCoy"
Date:
Subject: Re: [SQL] Finding strings inside a field...