Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I needed to write a very simple que

Status
Not open for further replies.

aimskee

Programmer
Feb 3, 2000
60
US
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

 
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 [tt]\r[/tt] ( carriage return ) left since the conversion from Windows.

Feherke.
[link feherke.github.com/][/url]
 
Feherke,
Thanks, I will get ride of invisibles.
Aimskee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top