RE: Difficulty with SQL LIKE clause

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Not exactly clear what database you're using.  In SQL Server the syntax
is

SELECT [options]
FROM [table]
WHERE [field] LIKE '%whatever value you're looking for%'

The % means any string of characters, so it doesn't have to be exact

Best of luck

Nate Tobik
(412)661-5700 x206
VigilantMinds

-----Original Message-----
From: David Freedman [mailto:eatc7402@xxxxxxxxxxx] 
Sent: Friday, February 25, 2005 3:28 PM
To: php-general@xxxxxxxxxxxxx
Subject:  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.

David F.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux