Welcome to WebmasterWorld Guest from 54.227.52.24

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

MYSQL: how do I select rows where a column contains a certain string?

     

ocelot

8:37 pm on Nov 7, 2004 (gmt 0)

10+ Year Member



I tried

SELECT * FROM blog_posts WHERE keywords CONTAINS 'design' ORDER BY timestamp

but that gave a query error

bobnew32

8:40 pm on Nov 7, 2004 (gmt 0)

10+ Year Member



You need somthing dealing with the mysql full text searching I believe.

ocelot

8:43 pm on Nov 7, 2004 (gmt 0)

10+ Year Member



oh well see I need to have it find rows where the keywords column *contains* "design" but may also contain other stuff

so say I have a row where keywords = "ewoinfd cweowm wo design fwpom dwopkjo weo"

I want the query to return that row

jam13

9:10 pm on Nov 7, 2004 (gmt 0)

10+ Year Member



How about:

SELECT * FROM blog_posts WHERE keywords LIKE '%design%' ORDER BY timestamp

ocelot

9:13 pm on Nov 7, 2004 (gmt 0)

10+ Year Member



thanks jam that did it

villar

6:42 am on Dec 12, 2004 (gmt 0)



awesome jam :)

I had a similar prob to ocelot

I spent a whole night tryin to find the right answer and all that was missing from my script was a couple of percentage signs :: rolls eyes ::

cheers :)

coopster

1:06 pm on Dec 13, 2004 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



We're glad you found us, villar. Welcome to WebmasterWorld.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month