Solved

Search two keyword togather!!

Posted on 1998-09-23
3
236 Views
Last Modified: 2010-03-19
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
Comment
Question by:ruisun
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Accepted Solution

by:
manish77 earned 50 total points
ID: 1090234
IF i UNDERSTAND YOUR QUESTION CORRECTLY THIS MIGHT HELP...

SELECT * from Name Where columname LIKE KeyworD OR COLOUMNAME LIKE KEYWORD2
0
 

Author Comment

by:ruisun
ID: 1090235
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
 
LVL 1

Expert Comment

by:gertrude
ID: 1090236
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question