List:MySQL on Win32« Previous MessageNext Message »
From:Todd Farmer Date:November 27 2007 5:21pm
Subject:Re: QUERY Structure?
View as plain text  
Hi Dave,

> This is not the QUERY, that is a bit longer than this, but the theory is 
> the same. Can this be done, if so how should it be structured?

If I understand the question right, sure it can be done:

SELECT id, LEFT(joketext, 20) FROM joke WHERE jokedate >= "2004-04-17" 
AND joketext LIKE "%chicken%" ;

The joketext LIKE "%chicken%" condition won't be able to use any indexes 
and could perform pretty slowly.  You might consider looking at 
full-text indexes and search if you can use MyISAM tables:

http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html

Obviously, whether or not this is a good option depends on your actual 
query and use cases.

Best regards,

-- 
Todd Farmer
Thread
QUERY Structure?grovesdavid27 Nov
  • RE: QUERY Structure?Jorge Bastos27 Nov
  • Re: QUERY Structure?Todd Farmer27 Nov
  • RE: QUERY Structure?Muthukumar Selvarasu27 Nov
  • RE: QUERY Structure?John Bonnett27 Nov
    • Re: QUERY Structure?Randy Clamons27 Nov