SELECT WHERE length of content question

SELECT WHERE length of content question

am 09.03.2011 23:49:42 von ron.piggott

------=_NextPart_000_001A_01CBDE82.5E5E3C60
Content-Type: text/plain;
charset="UTF-8"
Content-Transfer-Encoding: quoted-printable


Is there a command in mySQL that would allow me to SELECT the rows where =
the `fax` column is more than 11 characters long?=20

OR=20

Do I need to use PHP to assess this?

Ron

The Verse of the Day
â€=9CEncouragement from Godâ€=99s Wordâ€=9D
http://www.TheVerseOfTheDay.info=20

------=_NextPart_000_001A_01CBDE82.5E5E3C60--

Re: SELECT WHERE length of content question

am 09.03.2011 23:53:54 von Kesavan Rengarajan

--0016e6551f229daa17049e149b50
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Have a look at this:
http://dev.mysql.com/doc/refman/5.1/en/string-functions.html #function_char-=
length

On Thu, Mar 10, 2011 at 9:49 AM, Ron Piggott g
> wrote:

>
> Is there a command in mySQL that would allow me to SELECT the rows where
> the `fax` column is more than 11 characters long?
>
> OR
>
> Do I need to use PHP to assess this?
>
> Ron
>
> The Verse of the Day
> =93Encouragement from God=92s Word=94
> http://www.TheVerseOfTheDay.info
>

--0016e6551f229daa17049e149b50--

Re: SELECT WHERE length of content question

am 10.03.2011 00:38:38 von Daniel Brown

On Wed, Mar 9, 2011 at 17:49, Ron Piggott
wrote:
>
> Is there a command in mySQL that would allow me to SELECT the rows where the `fax` column is more than 11 characters long?

There is.

SELECT * FROM tblName WHERE CHAR_LENGTH(fax) >= 11;

(Presuming you meant greater than or equal to eleven, as in an
invalid US/Canadian phone number.)

--

Network Infrastructure Manager
http://www.php.net/

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

RE: SELECT WHERE length of content question

am 11.03.2011 18:59:55 von Geoffrey Pitman

--20cf307f326ac341ae049e38badd
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

You should be able to use the MySQL command LENGTH() command. I'm assuming
that your fax field is a varchar or char(10) field. If it's a number (which
it probably shouldn't be), I suppose you could write a query to find values
equal to or greater than 100,000,000,000.

http://dev.mysql.com/doc/refman/5.5/en/string-functions.html #function_lengt=
h

I hope this helps.

Geoff

---------- Forwarded message ----------
From: "Ron Piggott"
To:
Date: Wed, 9 Mar 2011 17:49:42 -0500
Subject: SELECT WHERE length of content question

Is there a command in mySQL that would allow me to SELECT the rows where th=
e
`fax` column is more than 11 characters long?

OR

Do I need to use PHP to assess this?

Ron

The Verse of the Day
=93Encouragement from God=92s Word=94
http://www.TheVerseOfTheDay.info

--20cf307f326ac341ae049e38badd--

Re: RE: SELECT WHERE length of content question

am 11.03.2011 19:34:44 von Constantin Brinzoi

Do not forget to use TRIM function as well:

LENGTH(TRIM(fax))

in order to elliminate leading and trailing spaces.

Aurel

----- Original Message -----
From: "Geoffrey Pitman"
To:
Sent: Friday, March 11, 2011 7:59 PM
Subject: [PHP-DB] RE: SELECT WHERE length of content question


You should be able to use the MySQL command LENGTH() command. I'm assuming
that your fax field is a varchar or char(10) field. If it's a number (which
it probably shouldn't be), I suppose you could write a query to find values
equal to or greater than 100,000,000,000.

http://dev.mysql.com/doc/refman/5.5/en/string-functions.html #function_length

I hope this helps.

Geoff

---------- Forwarded message ----------
From: "Ron Piggott"
To:
Date: Wed, 9 Mar 2011 17:49:42 -0500
Subject: SELECT WHERE length of content question

Is there a command in mySQL that would allow me to SELECT the rows where the
`fax` column is more than 11 characters long?

OR

Do I need to use PHP to assess this?

Ron

The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info


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