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

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL: How to see items from more than one vendor

Re: SQL: How to see items from more than one vendor

From: Rudy Fernandes <rferdy_at_americasm01.nt.com>
Date: Wed, 15 Dec 1999 14:31:29 -0500
Message-ID: <3857EC91.A436B981@americasm01.nt.com>


Dave Rawding wrote:

> Given an item_vendor table with fields item, vendor, etc. how do I
> find situations where the same item is purchased from more than one
> vendor? This is not normally the case, but it does happen
> occassionally. tia.

Assuming that the combination of the columns item and vendor are unique in the item-vendor table, the following SQL will return all items with more than one vendor

select item, count(*)
from item_vendor
group by 1
having count(*) > 1;

Rudy Received on Wed Dec 15 1999 - 13:31:29 CST

Original text of this message

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