Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: Intelligent Queries


Message #1 by phillipl@s... on Fri, 8 Jun 2001 13:44:24
Phillip:

Build the WHERE clause in your query such that it filters multiple 
conditions.  For example, given the following table:

  ID  vchText
  --- ---------------------------
  1   MacIntosh apples are red
  2   Sour apples are green
  3   Oranges are...'er...orange

And given that you want to find a text string containing both "apple" 
and "red", you could write the following:

  SELECT
    ID,
    vchText
  FROM
    tblFruit
  WHERE
    (vchText LIKE '%apple%')
    AND (vchText LIKE '%red%')

Cheers.

- Roger Nedel

  Nedel Software Solutions
  rnedel@b...

====================

> Ok So far I know of a couple of ways to search a database for some EXACT 
> text.  But what if I want to look up text in a database with text 
> seperated by spaces or something like " text + text "  for example I 
make 
> a query for " apples + Red " like you could in say an index server or 
> something.
> 
> How would I string a SQL statement and whatever else together to make a 
> query like that work or return results?  What have you guys come up with 
> in the past?
> 
> Thanks
> 

  Return to Index