views:

28

answers:

2

hello all, i have table contain two column id and word .

word column may contain one word or two or three ex ( computer , computer software , computer software computer )

i want search the text if it contain any word in that table .

thank you .

+1  A: 

If it is small amount of text, you can use "like" with "%" e.g "select * from tableX where word like '%computer%'"

Pradeep
A: 
  • change the key word list into a table
  • JOIN with LIKE

Optionally:

  • COUNT should match number of search terms
  • COUNT can also be used for ranking

Better still for larger tables

  • or use full text search

Like this

SELECT
    ID
FROM
    Mytable M
    JOIN
    SearchTable S On M.Word LIKE '%' + S.SearchWord + '%'
gbn
hello gbn can s be parameter ?
fligant
S is an Alias for SearchTable
Zuhaib
sorry i mean M.Word
fligant