Forum Moderators: coopster & phranque

Message Too Old, No Replies

MySQL: Is it possible to do: SELECT .... WHERE field contains 'value'?

         

Allen

10:37 am on Mar 28, 2003 (gmt 0)

10+ Year Member



Hi all,

I'm doing a search script. I'm sure it's possible but I can't find it in the mysql manual.

TIA

Allen

Allen

10:42 am on Mar 28, 2003 (gmt 0)

10+ Year Member



DOH!

Google is Your Friend(TM):

From: [databasejournal.com...]

mysql> SELECT JokeText FROM Jokes WHERE JokeText LIKE "%chicken%";

This query displays the text of all jokes that contain the word "chicken" in their JokeText column. The LIKE keyword tells MySQL that the named column must match the given pattern. In this case, the pattern we've used is "%chicken%". The % signs here indicate that the word "chicken" may be preceded and/or followed by any string of text.

(posted here first 'cause I need a quick answer o_O )

Allen

Birdman

11:57 am on Mar 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The MySQL [mysql.com] Manual will be a very handy reference for you also.

Allen

12:11 pm on Mar 28, 2003 (gmt 0)

10+ Year Member



Why don't people ever read posts beforeposting replys?

The MySQL manual search system is slightly weird in that unless you know the command you're looking for, I've found it's actually quite hard to find anything.

Allen

Birdman

12:38 pm on Mar 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry I missed that. By the way, the slightly weird search system at MySQL.com returned the answer at #4 in the serps for the search term "search". Imagine that!

Added: The site search here is your friend also. A simple search for "search with mysql" returns your answer at #2.

I suppose we should both open our eyes wider ;)