[thelist] msql: using an index to search across columns?

Joshua Olson joshua at waetech.com
Mon Sep 29 12:52:55 CDT 2003


----- Original Message ----- 
From: "rudy" <rudy937 at rogers.com>
Sent: Monday, September 29, 2003 12:34 PM


> hi dunstan
>
> try this --
>
>     select title, body
>       from blog_post
>      where concat(title,body) LIKE '%telegraph%'
>        and concat(title,body) LIKE '%death%'

Rudy,

I can see it now:

title = 'call me on the tele'
body = 'graphs are SOOOOOO cool'

Ugh.

Perhaps you want to put a space in between instead of a straight
concatenation?

Also, what is the practical limit of the length of the data and fields?  If
both body and title are varchar(500), then would not one expect the
resulting datatype of the concatenation to be varchar(500)?  I'm not a MySQL
guru, so I'm not sure, but it seems like it would be easy to overflow during
this concatenation.

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com
706.210.0168



More information about the thelist mailing list