RE: [PHP-DB] mySQL Query and blank fields
| From: | Niklas Lampén | Date: | Thu, 25 Oct 2001 13:37:20 +0000 |
| Subject: | RE: [PHP-DB] mySQL Query and blank fields | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-13709@lists.php.net to get a copy of this message | ||
I'd like to do it in mySQL, I think it will be done much quicker since
it a large database. The type of the field is allready varchar.
Niklas
-----Original Message-----
From: Rick Emery [mailto:remery@excel.com]
Sent: 25. lokakuuta 2001 16:08
To: Php-DB
Subject: RE: [PHP-DB] mySQL Query and blank fields
First, I wouldn't use length(), I'd use REGEXP: SELECT * FROM
foo_table
WHERE fieldname REGEXP '..+'
It's quicker.
As far as the second question, do you wish to do it in PHP or MySQL?
Does the value in MySQL require other computations (so, it must remain
numeric) or can it be a CHAR string?
-----Original Message-----
From: Niklas Lampén [mailto:niklas.lists@publico.fi]
Sent: Thursday, October 25, 2001 8:04 AM
To: Php-DB
Subject: RE: [PHP-DB] mySQL Query and blank fields
Thanks a lot! I quite didn't know what to look for in the manual.
I actually have another question:
If I want to update several fields, add a number to the end of the
fields value, how do I do that? I have field with value '9876' and if I
do "...field=field+'5'..." the value turns into '9881' not
'98765' as I
expected.
Niklas
-----Original Message-----
From: Rick Emery [mailto:remery@excel.com]
Sent: 25. lokakuuta 2001 15:56
To: Php-DB
Subject: RE: [PHP-DB] mySQL Query and blank fields
Change that to:
SELECT * FROM foo_table WHERE length(bar_field)>1;
-----Original Message-----
From: Tamas Arpad [mailto:sts@mail.xubion.hu]
Sent: Thursday, October 25, 2001 8:01 AM
To: Niklas Lampén; Php-DB
Subject: Re: [PHP-DB] mySQL Query and blank fields
On Thursday 25 October 2001 13:16, Niklas Lampén wrote:
> How can I query for specified fields that has to contain atleast 2
> charters?
SELECT * FROM foo_table WHERE length(bar_field)>=1;
Arpi
>
> Example:
> Field AAA contains '' (NULL) => No match
> Field BBB contains ' ' (one charter) => No match
> Field CCC contains 'ab' => Match
> Field DDD contains 'abcdefg' => Match
>
>
> Niklas
--
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
--
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