Reply
Length of field in SQL
Old 06-14-2004, 07:37 PM Length of field in SQL
eyedam's Avatar
Average Talker

Posts: 27
Location: Latvia
Hi!

Is there a way to use the length of a text value in "where" conditions?

I found this in W3Schools.com for MS Access:
LEN(c) - Returns the length of a text field

Is there something similar in MySQL? If no, is there any other way I can select, for example, all rows where one field's value is no longer than 5 characters?

Thanks,
eyedam
__________________
The signature chooses the wizard, not the wizard chooses the signature...
eyedam is offline
Reply With Quote
View Public Profile Visit eyedam's homepage!
 
When You Register, These Ads Go Away!
Old 06-14-2004, 08:02 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
PHP and Unicode with UTF-8
Posts: 3,111
Location: Toronto, Ontario
Never tried, but could you not use LENGTH() ?

PHP Code:
$sql "SELECT * FROM table WHERE LENGTH(myfield) > 10"
Christopher is offline
Reply With Quote
View Public Profile Visit Christopher's homepage!
 
Old 06-15-2004, 08:14 AM
eyedam's Avatar
Average Talker

Posts: 27
Location: Latvia
Oh, thanks! It worked! And I thought I have already tried that...

eyedam
__________________
The signature chooses the wizard, not the wizard chooses the signature...
eyedam is offline
Reply With Quote
View Public Profile Visit eyedam's homepage!
 
Reply     « Reply to Length of field in SQL
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12821 seconds with 12 queries