Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

Search two keyword togather!!

I think I know how to search in a table "SELECT * from Name Where columname=Keyword"
      But now I want that I can search in a table not just by one keyword , but by two. or more
      T.ex. I want to search something match two keyword by writing: keyword1 + keyword2  in the search form  Like I do it in "Yahoo", I want to know how can I write script??  
0
ruisun
Asked:
ruisun
1 Solution
 
manish77Commented:
IF i UNDERSTAND YOUR QUESTION CORRECTLY THIS MIGHT HELP...

SELECT * from Name Where columname LIKE KeyworD OR COLOUMNAME LIKE KEYWORD2
0
 
ruisunAuthor Commented:
Thanks for answer!!
But when I write in form field "keyword1 + keyword2", then in the action file how can I difference the keyword1 and keyword2, because now "keyword1 + keyword2" is a whole string!! I have to seperate them first, I think!! Then I can use "SELECT * from Name Where columname LIKE KeyworD1 OR COLOUMNAME LIKE KEYWORD2"

Thanks again!!!


0
 
gertrudeCommented:
If you don't need to search on substrings you might try something like:

  SELECT au_lname
    FROM authors
   WHERE au_lname in('Bennet', 'Dull')

If you do use the LIKE operator, be sure to include '%' on one or both ends of the string to be search for.  For example:

  SELECT au_lname
    FROM authors
   WHERE au_lname LIKE 'smi%'


0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now