• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

select problem

 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?)
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is there any words before "rain" and "ramses" ?
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
depends: may be yes and may be no - one does not know whaat users input...
 
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
reply
    Bookmark Topic Watch Topic
  • New Topic