Re: SQL Question... Boolean Logic

From: Don Vick <dvick_at_lanier.com>
Date: 1995/04/20
Message-ID: <D7C9zq.AIL_at_lanier.com>#1/1


In article <ggrieffD7BDn4.84x_at_netcom.com>, Greg Grieff <ggrieff_at_netcom.com> wrote:
>
>I have the following table:
>
>create table keywords (
> recid number(9) not null, /* primary key */
> docid number(9) not null, /* foreign key to another table */
> keyword varchar2(30) not null, /* keyword entry */
>)
>
>Sample data:
> recid docid keyword
>--------------------------------------------
> 1 1 apples
> 2 1 oranges
> 3 2 apples
> 4 2 pears
> 5 2 watermelon
>
>I want to return the unique values for docid that match boolean logic
>combinations of keyword values. For example, if I ask for all vaules for
>docid that have keywords, apples and oranges, I get the answer 1. I
>would like standard order of operations to apply to the values that I
>search for in keywords. And, (this is the difficult part) I would like a
>single SQL (non-PL/SQL) statement that does this.
>

Wouldn't the following give you what you want, or am I missing something?

   select distinct docid where keyword='apples' or keyword='oranges';



Donald E. Vick (dvick_at_lanier.com, dvick_at_crl.com) Voice: (404) 493-2194 Fax: (404) 493-2399 Received on Thu Apr 20 1995 - 00:00:00 CEST

Original text of this message