X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id CA074D1BB4A for ; Wed, 5 Nov 2003 09:34:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 07834-01 for ; Wed, 5 Nov 2003 05:34:27 -0400 (AST) Received: from vayron.anpe.fr (euclide.anpe.fr [195.101.137.18]) by svr1.postgresql.org (Postfix) with ESMTP id 6443ED1B8F5 for ; Wed, 5 Nov 2003 05:34:24 -0400 (AST) Received: from thon-front.anpe.fr (localhost.anpe.fr [127.0.0.1]) by vayron.anpe.fr (antivirus) with ESMTP id F2F0C32FB1 for ; Wed, 5 Nov 2003 10:34:28 +0100 (CET) Received: from ex-bal-01.anpe.fr ([10.0.6.102]) by thon-front.anpe.fr with Microsoft SMTPSVC(5.0.2195.5329); Wed, 5 Nov 2003 10:34:24 +0100 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Subject: Re: Please help me to slove this SQL statements Date: Wed, 5 Nov 2003 10:34:24 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [SQL] Please help me to slove this SQL statements Thread-Index: AcOjGOgxh1lQWqf1R8mNkl6AhhtBZAAZhRyg From: "Patrick JACQUOT (DSI NOISIEL)" To: X-OriginalArrivalTime: 05 Nov 2003 09:34:24.0593 (UTC) FILETIME=[FFE5CC10:01C3A37F] X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/27 X-Sequence-Number: 15842 -----Message d'origine----- De : Freshman [mailto:abc@msn.com] Envoy=E9 : jeudi 30 octobre 2003 13:38 =C0 : pgsql-sql@postgresql.org Objet : [SQL] Please help me to slove this SQL statements There are three table in database which is suppliers, projects, and shipments suppliers contain suppliers id, name ...etc projects contain project name ..suppliers ID ( J1---J7) ...etc shipments table contain suppliers ID , PROJECTS ID how can i query to find out the suppliers to supply all the projects ID I would suggest: SELECT * from suppliers WHERE NOT EXISTS( SELECT * FROM projects WHERE NOT EXISTS( SELECT * from shipments=20 WHERE shipments.suppliers_ID =3D suppliers_suppliers_id AND shipments.project_ID =3D project.project_id ) ); so you select every supplier who didn't miss any project. Is that you want to do? ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match