- Original Poster
- #1
Please be gentle - I'm trying to teach myself the basics of MySQL and I'm after a little help.:|
Is it possible to search for a keyword within a field and then return that field if the keyword is in the field, but not at the start of the field?
For example, say I'm interested in looking for the word "frogs". I know how to grab the data from a field if it appears at the start of the field using:
"SELECT * FROM SomeTable WHERE description LIKE 'Frogs' "
So if SomeTable was:
ID Description
1 Frogs live in ponds
2 You might find frogs in ponds
3 Tadpoles grow in ponds
The code above would return:
1 Frogs live in ponds
but not:
2 You might find frogs in ponds or
3 Tadpoles grow in ponds
What I'm asking is, is there a way to interrogate the table to return:
1 Frogs live in ponds
2 You might find frogs in ponds
because they both contain the word "frogs", albeit in different places?
Sorry if this is a really basic question, but I'd love to know the answer!
Many thanks in advance,
Jeff
Is it possible to search for a keyword within a field and then return that field if the keyword is in the field, but not at the start of the field?
For example, say I'm interested in looking for the word "frogs". I know how to grab the data from a field if it appears at the start of the field using:
"SELECT * FROM SomeTable WHERE description LIKE 'Frogs' "
So if SomeTable was:
ID Description
1 Frogs live in ponds
2 You might find frogs in ponds
3 Tadpoles grow in ponds
The code above would return:
1 Frogs live in ponds
but not:
2 You might find frogs in ponds or
3 Tadpoles grow in ponds
What I'm asking is, is there a way to interrogate the table to return:
1 Frogs live in ponds
2 You might find frogs in ponds
because they both contain the word "frogs", albeit in different places?
Sorry if this is a really basic question, but I'd love to know the answer!
Many thanks in advance,
Jeff