Solved

Search two keyword togather!!

Posted on 1998-09-23
3
214 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
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Suggested Solutions

In this article—a derivative of my DaytaBase.org blog post (http://daytabase.org/2011/06/18/what-week-is-it/)—I will explore a few different perspectives on which week today's date falls within using Microsoft SQL Server. First, to frame this stu…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now