Re: Difficulty with SQL LIKE clause
| From: | Stan F | Date: | Sat, 26 Feb 2005 16:42:18 +0000 |
| Subject: | Re: Difficulty with SQL LIKE clause | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-209508@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "David Freedman" <eatc7402@comcast.net>
To: <php-general@lists.php.net>
Sent: Friday, February 25, 2005 11:27 PM
Subject: [PHP] Difficulty with SQL LIKE clause
> When I use this query in PHP it works, and I get all things with the YEAR
of
> 1977, as I expected.
>
> $query= "SELECT * FROM my_table WHERE Year LIKE 1977 ";
>
> But, when I use this query it does not work.
>
> $query= "SELECT * FROM my_table WHERE Year LIKE 197* ";
>
> I thought I should get the result of ALL things with the years in the
1970's
> (1970-1979). But the asterisk in the LIKE clause does not seem to work.
> I have tried various syntax's to try to get the 197* recognized but
without
> any luck.
>
> Can the '*' be used? What am I doing wrong.
AFAIK you cannot. SQL wildcard symbols are % and _.
>
> David F.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>