Go Back   Dynamic Drive Forums > General Coding > MySQL and other databases
Search Dynamic Drive Forums:

Reply
 
Thread Tools Search this Thread
  #1  
Old 11-04-2009, 03:42 AM
james438 james438 is offline
Senior Coders
 
Join Date: Jan 2007
Location: Iowa
Posts: 383
Thanks: 17
Thanked 9 Times in 9 Posts
Default frustrated with lcase

Hi, I am using mysql 5.0.67 and am using the following to find the made up term terewS

Code:
SELECT ID, summary, category FROM news WHERE (lcase(concat(ID, summary, category)) LIKE '%terews%')
the above code does not work, but the following does:
Code:
SELECT ID, summary, category FROM news WHERE (lcase(concat(ID, summary, category)) LIKE '%terewS%')
Anyone know what I am doing wrong? I recently ported all of my data over from my MySQL database 4.0 to 5.0.

The code does work with the 4.0 database. I am looking into it. If I figure out the answer before anyone else does I will post a reply with the solution.
__________________
To choose the lesser of two evils is still to choose evil.

Last edited by james438; 11-04-2009 at 06:17 PM.
Reply With Quote
  #2  
Old 11-04-2009, 08:27 AM
james438 james438 is offline
Senior Coders
 
Join Date: Jan 2007
Location: Iowa
Posts: 383
Thanks: 17
Thanked 9 Times in 9 Posts
Default

got it. The problem was with concat, not lcase.

Quote:
CONCAT(str1,str2,...)

Returns the string that results from concatenating the arguments. May have one or more arguments. If all arguments are nonbinary strings, the result is a nonbinary string. If the arguments include any binary strings, the result is a binary string. A numeric argument is converted to its equivalent binary string form; if you want to avoid that, you can use an explicit type cast, as in this example:
SELECT CONCAT(CAST(int_col AS CHAR), char_col);
ref

In other words to fix this I would need to convert my argument to
Code:
SELECT ID, summary, category FROM news WHERE lcase(concat(cast(ID as char),summary,category)) LIKE '%terews%'
The original argument I was using should not have been working, but possibly that was by design prior to MySQL 5.0 series.
__________________
To choose the lesser of two evils is still to choose evil.

Last edited by james438; 11-04-2009 at 08:51 AM.
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:18 AM.

Home - Contact Us - Archives - Link to DD - Top 

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.