Bvz
Bvz

Reputation: 73

SQL find Word in String (any Spelling)

I want to find a word in a string with SQL. I currently use:

SELECT * FROM dreams
WHERE 
    title 
LIKE '%lo%'

But I want also to find other spellings like "Lo" or "LO" and so on..

Any Ideas ?

Upvotes: 0

Views: 338

Answers (3)

CLaFarge
CLaFarge

Reputation: 1365

We have no idea what version of SQL, but here's a very possibly related post on SOundex, and another on Full Text Searching, a page on CONTAINS.

The more info you provide, the better able we are to help.

I hope that SOUNDEX, or Full Text Searching, or CONTAINS, alternatively, are useful to you.

Upvotes: 0

ramana_k
ramana_k

Reputation: 1933

Convert it to upper case before comparing

SELECT * FROM dreams
WHERE 
    upper(title) 
LIKE '%LO%'

Upvotes: 4

Aetiranos
Aetiranos

Reputation: 329

SELECT * FROM dreams WHERE title LIKE '%lo%'
union
SELECT * FROM dreams WHERE title LIKE '%LO%'
union
SELECT * FROM dreams WHERE title LIKE '%Lo%';

Upvotes: 0

Related Questions