Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> SQL query problem

SQL query problem

From: mikeyb <bamikeb_at_hotmail.com>
Date: 23 Jan 2006 06:51:59 -0800
Message-ID: <1138027919.283755.228340@g49g2000cwa.googlegroups.com>


I'm trying to select records in a table where the multiple occurances of data in one field are not matched by data in another. Difficult to explain (or bad explaination), I guess thats why I'm struggling to write the sql.
As an example of what I'm trying to do , if we have the following data:

Person, Fruit Bought
======,==========

Bob, Apple
Tom, Kiwi
Jim, Peach
Bob, Kiwi
Tom, Pear
Jim, Apple
Tom, Kiwi

I want to return the people who have not bought an Apple or a Peach. ie Tom in this example.

The table I'm looking at is pretty big so I'm looking for a low cost solution.

I've been trying to use "where not exists" but I'm not getting anywhere.

Thanks for any help.

Mike Received on Mon Jan 23 2006 - 08:51:59 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US