Re: Trying to make efficient "all vendors who can provide all items" - Mailing list pgsql-sql

From
Subject Re: Trying to make efficient "all vendors who can provide all items"
Date
Msg-id 042301c405db$b63c5340$2766f30a@development.greatgulfhomes.com
Whole thread Raw
In response to Re: Trying to make efficient "all vendors who can provide all items"  ("Matt Chatterley" <zen31329@zen.co.uk>)
Responses Re: Trying to make efficient "all vendors who can provide all items"
List pgsql-sql
Of all the proposed solutions, this appears to run the fastest, and not
require the creation of an additional table.

Thanks!

Terry Fielder
Manager Software Development and Deployment
Great Gulf Homes / Ashton Woods Homes
terry@greatgulfhomes.com
Fax: (416) 441-9085


> -----Original Message-----
> From: pgsql-sql-owner@postgresql.org
> [mailto:pgsql-sql-owner@postgresql.org]On Behalf Of Matt Chatterley
> Sent: Monday, March 08, 2004 3:41 PM
> To: terry@ashtonwoodshomes.com
> Cc: pgsql-sql@postgresql.org
> Subject: Re: [SQL] Trying to make efficient "all vendors who
> can provide
> all items"
>
>
> Hmm. My PGSQL knowledge is rusty, so this may be slightly
> microsoftified..
>
> How about just:
>
> SELECT V.VendorID, V.VendorName, COUNT(IV.ItemID)
> FROM Vendor V
> INNER JOIN Item_Vendor IV ON IV.VendorID = V.VendorID AND
> IV.ItemID IN (1,
> 2, 3, 4, 5)
> GROUP BY V.VendorID, V.VendorName
> HAVING COUNT(IV.ItemID) = 5
>



pgsql-sql by date:

Previous
From: Daniel Henrique Alves Lima
Date:
Subject: Re: Help to simplify sample query
Next
From: ow
Date:
Subject: currval() without specifying the sequence name