Re: Non case-sensitive SQL Query
| From: | Bob Lutz | Date: | Fri, 18 Aug 2000 12:42:40 +0000 |
| Subject: | Re: Non case-sensitive SQL Query | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-2157@lists.php.net to get a copy of this message | ||
In order to make the records returned contain all possible case combinations,
you almost need to retrieve a subset (like all those that begin with 'A' or 'a')
then perform regular expression matching on the field.
OR, you could force the field all to lower case when the data is entered into
the table, then when you retrieve it for display, if it has a regular pattern
(like 'always capitalize the first letter of the first name') modify the string
to display correctly.
Bob Lutz
Jeroen ten Berge wrote:
> Is DB2 by default case sensitive on queries ?
> You could do an like 'Anders%' or like 'anders%'
>
> -----Original Message-----
> From: Anders Dannberg [mailto:anders.dannberg@edk.se]
> Sent: Friday, August 18, 2000 12:44
> To: php-db@lists.php.net
> Subject: [PHP-DB] Non case-sensitive SQL Query
>
> Hi all!
>
> I need some help on how to make a NON case-sensitive sql query. I use the
> following query which outputs what i need:
>
> $query = "SELECT * FROM user INNER JOIN maintable ON user.number =
> maintable.number WHERE name LIKE 'Anders%'";
>
> However, as this is case-sensitive, it will not display, for example records
> containing "anders", but only "Anders" etc.
> Is there a way i can make sql-queries NON case-sensitive (without changing
> the already inputted data in the DB)
>
> Is there a way i can do this in within the code? Without any changes to
> database settings...
> I'm using DB2, PHP4.
>
> Thanks in advance.
> Anders
>
> --
> 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
>
> --
> 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