| Author |
select problem
|
miguel lisboa
Ranch Hand
Joined: Feb 08, 2004
Posts: 1281
|
|
i have a field that has a sentence
i want to query the database to find all records with exactly that word within any sentence in that column
for example 1 wanna find the word "its"
the sentence:
"today its gonna rain"
my sql:
select * from table x where column y like '%its%'
this wont work
what am i doing wrong?
thanks in advance
|
java amateur
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24061
|
|
|
Sounds OK to me (given that you're using proper syntax for the table and column names.) What flavor of "this won't work" are we talking about (i.e., what happens when you do it?)
|
[Jess in Action][AskingGoodQuestions]
|
 |
miguel lisboa
Ranch Hand
Joined: Feb 08, 2004
Posts: 1281
|
|
i expressed myself incorrectly
imagine i'm looking for the word "ra"
if in the same column (in any other entry) i have the word "rain", or "ramses", i get all of them instead of only getting the exact word "ra", for which i searched...
hope i made myself clear
|
 |
Muhammad Saifuddin
Ranch Hand
Joined: Dec 06, 2005
Posts: 1318
|
|
|
is there any words before "rain" and "ramses" ?
|
Saifuddin..
[Linkedin] How To Ask Questions On JavaRanch My OpenSource
|
 |
miguel lisboa
Ranch Hand
Joined: Feb 08, 2004
Posts: 1281
|
|
|
depends: may be yes and may be no - one does not know whaat users input...
|
 |
Somnath Mallick
Ranch Hand
Joined: Mar 04, 2009
Posts: 471
|
|
miguel lisboa wrote:select * from table x where column y like '%its%'
I think this should work. I tried with some of my tables and they gave the results fine! What problems are you facing when you run this query?
|
 |
 |
|
|
subject: select problem
|
|
|