List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:January 14 2000 5:12pm
Subject:Re: Searching for a specific record problem
View as plain text  
At 10:35 AM -0600 01-14-2000, William R. Mattil wrote:
>Group,
>
>
>given something similar to:
>
>
>+-------------+-------------+------+-----+---------+-------+
>| Field       | Type        | Null | Key | Default | Extra |
>+-------------+-------------+------+-----+---------+-------+
>| date        | varchar(10) | YES  |     | NULL    |       |
>| remarks     | text        | YES  |     | NULL    |       |
>+-------------+-------------+------+-----+---------+-------+
>
>
>I would like to select records where the string "FOO" is contained
>within the remarks field.
>
>
>select date,remarks from table_name where remarks like "%FOO";
>does not produce the desired reults and yet:
>
>select date,remarks from table_name where date like "%2000";
>
>does .....
>
>How does one go about displaying records where a TEXT field conatins
>some *value* ????

Your queries will find only records where remarks contains "FOO"
at the end of the value or date contains "2000" at the end of the
value.  If you want to find them anywhere in the value, put a "%"
on both sided of the pattern:

select date,remarks from table_name where remarks like "%FOO%";
select date,remarks from table_name where date like "%2000%";


-- 
Paul DuBois, paul@stripped
Thread
Searching for a specific record problemWilliam R. Mattil14 Jan
  • Re: Searching for a specific record problemPaul DuBois14 Jan