RE: [PHP-DB] Case-insensitive SELECT
| From: | Richard Allsebrook | Date: | Wed, 16 Aug 2000 07:51:56 +0000 |
| Subject: | RE: [PHP-DB] Case-insensitive SELECT | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-2078@lists.php.net to get a copy of this message | ||
Like IS case insensitive (according to SQL92 anyway :-)
How about:
SELECT * FROM tbl WHERE fld LIKE 'Field Name'
Will match:
'Field Name', "Field name", "field name"
but not "Field", "Field Value"
so you will need
SELECT * FROM tbl WHERE fld LIKE 'Field%' AND flg NOT LIKE 'Field Value'
Hope this helps...
_____
~ Richard Allsebrook ~
Applications Developer and Webmaster
Easysoft Limited, No3 The Embankment, Leeds, LS1 4BJ
http://www.easysoft.com <http://www.easysoft.com> - http://www.cinema.com
<http://www.cinema.com>
"A computer lets you make more mistakes faster than any invention in human
history - with the possible exceptions of handguns and tequila."
_____
-----Original Message-----
From: David B. Small [mailto:dbsmall@alumni.haas.org]
Sent: Tuesday, August 15, 2000 8:57 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Case-insensitive SELECT
Apologies in advance for what is assuredly a naive question.
I think I understand the SELECT...WHERE...LIKE query form (although I'm
still not sure why, with ODBC at least, I must use % instead of *...or why
it even works)
But suppose I want to find all rows of "table" in which "field" is "Field
Name"....
I'd use "SELECT * FROM tale WHERE field='Field Name'"
If I now wanted it to match on 'Field Name', "Field name", "field
name",
"Field" etc., but not "Field Value"
I could do some string manipulations, and perform many selects.
But is there a more efficient way of expressing wildcards (either in SQL or
in PHP's interface to it)?
(eg, I'd love to say field LIKE [F|f]ield[| [N|n]ame] or something like
that)
-----------------
David B. Small
dbsmall@alumni.haas.org
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net