INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

I needed to write a very simple que

I needed to write a very simple que

(OP)
I needed to write a very simple query using MySQL where I wanted to select all the words in a field in a table (of a database) with a length of 4.
So I typed in the query tab the following and executed the query:

Select * from wordList where length(trim(cWord))='4'

Unfortunately the results of my query gave me all the words that have a length of 3, not 4.

I reran the same query on a similar table in MS Access and got all 4 letter words as asked for, but MySQL is giving me 3. I am new to MySQL so if you know what I am doing wrong, with the above query, let me know. The type of field I am using in MySQL is varchar(45). I also tried same query with MediumText type field and got the same result, 3 letter words with MySQL even tho' I'm asking for 4.

Thanks for any help.

Aimskee

RE: I needed to write a very simple que

Hi

I am quite sure the returned strings are 4 character long.

Check whether some whitespace characters other than space are there. I would say, some \r ( carriage return ) left since the conversion from Windows.

Feherke.
http://feherke.github.com/

RE: I needed to write a very simple que

(OP)
Feherke,
Thanks, I will get ride of invisibles.
Aimskee

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close