ruisun
asked on
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??
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??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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%'
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%'
ASKER
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!!!