Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hwXFl-0000uL-B1 for pgsql-general@arkaria.postgresql.org; Sat, 10 Aug 2019 19:42:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hwXFj-0001JK-4P for pgsql-general@arkaria.postgresql.org; Sat, 10 Aug 2019 19:42:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hwXFi-0001JD-Mj for pgsql-general@lists.postgresql.org; Sat, 10 Aug 2019 19:42:10 +0000 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hwXFf-0005RP-Ia for pgsql-general@lists.postgresql.org; Sat, 10 Aug 2019 19:42:09 +0000 Received: by mail-ot1-x334.google.com with SMTP id d17so145623502oth.5 for ; Sat, 10 Aug 2019 12:42:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=3tg+0EeqCz7Sz3zt0hJdAN46zgE4C+UC5cVeCekrM+w=; b=QPKHT2VjhgHBZAC/JYtiTT4SN+VHmtURqoSVUtVRGAA9jHH8wuSf1EezXOLA4ekEAr P61X0ZRvCKFr2NLOCTsEnqXMTieKwwAJC34fT5zYEIcjwYfC1bYWotHBFKVGj2w60C/o 2Mb2Na4iBEO+mIgLDS7qD1XQNd7dgN5n6MaU89eS/YEbd2n1XjOSbL2Oh5OmdsfCvUyC gcSspThICANfy6m2zjkaJop32UwN1k0Lfrf3gqWUVE7iGeObN2Zxomc6ki0bbWknT9RS 7wDOtSfjLjFdAxOW5ic7vsVjcn38q1A65w4hGZUD3OEaTNeRrvFqgRhb5V1ceWpz781m Nd4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=3tg+0EeqCz7Sz3zt0hJdAN46zgE4C+UC5cVeCekrM+w=; b=Qw8ssB+BNSUbv1cIyN2LGjMAjQEDj9lnpipNX5P7eHKHISRYsQG54OqY1IqxwHF6h8 YOjiabbfiObJmSf3Q9FuTravaG9jPkZyO+Z+F5TthARqVBRSZMkjwoFPWh+1QYmjOOUm 7urCEZOq662o33qFIqfWHH5MTjhaqfA8lri/OydnqPf3jbqy6lk3aZorLpP2CmpUsHaO GcyXYRhUqZQXPwSfi/Fyg6vQWfLIjtyxeE/R0hIvWLwWTFB0cTsXKqzXrc2YNyma1z1G 2Tgy+3c4ew7jxqcNr3qMwXx6JIe8/bSK9Ot2/U/SShxpxrjVXCMOyw9SVQLg+kV5rhvg it8Q== X-Gm-Message-State: APjAAAVu9YtpZcTCaA7ucs0JlQcHwo9WjtR9yQjuOhHtexF4CH1CGlBR iYI2yBtuzU9PZj4B8Fqlkdw= X-Google-Smtp-Source: APXvYqyUJuaWcLrb3cPpYEtHSkclTTEU7LcidY2HeHrDdRjTjVS5hWIbStwLgICBvyZOFkVjSxHbFQ== X-Received: by 2002:a02:29ca:: with SMTP id p193mr284268jap.88.1565466124422; Sat, 10 Aug 2019 12:42:04 -0700 (PDT) Received: from [192.168.1.108] (c-73-63-59-118.hsd1.ut.comcast.net. [73.63.59.118]) by smtp.gmail.com with ESMTPSA id u17sm85712804iob.57.2019.08.10.12.42.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Aug 2019 12:42:03 -0700 (PDT) From: Rob Sargent Message-Id: <4CC49DAD-E068-443F-896F-B78F08C99D2C@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_43D2A229-24A5-4E40-A91F-024FF62B29F6" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: Probably a newbie question Date: Sat, 10 Aug 2019 13:42:01 -0600 In-Reply-To: <2889ec92-e822-84a6-55af-655688ab9651@gmail.com> Cc: pgsql-general@lists.postgresql.org To: Ron References: <20190810185714.GA23952@panix.com> <2889ec92-e822-84a6-55af-655688ab9651@gmail.com> X-Mailer: Apple Mail (2.3445.104.11) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_43D2A229-24A5-4E40-A91F-024FF62B29F6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 >=20 > I'd look here: >=20 > SELECT > name > FROM > vendor > WHERE > bom_item.vendor_key =3D > ( > SELECT > vendor_key > FROM > mfg_vendor_relationship > WHERE > bom_item.mfg_key =3D mfg_key > AND > prefered =3D TRUE > AND > bom_item.project_key =3D project_key > =09 > ) >=20 >=20 > --=20 > Angular momentum makes the world go =E2=80=98round. You might get away with adding group by vendor_key if it turns out you=E2=80=99re simply getting many copies of vendor key = from that inner select. Run it alone to see. --Apple-Mail=_43D2A229-24A5-4E40-A91F-024FF62B29F6 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

I'd look = here:

SELECT
= name
FROM
= vendor
= WHERE = bom_item.vendor_key =3D
= (
= SELECT
= = vendor_key
= FROM
= = mfg_vendor_relationship
= WHERE
= = bom_item.mfg_key =3D mfg_key
= AND
= = prefered =3D = TRUE
= AND
= bom_item.project_key =3D project_key
=
= )


-- 
Angular = momentum makes the world go =E2=80=98round.

You might get away with adding
group by = vendor_key
if it turns out you=E2=80=99re simply getting many = copies of vendor key from that inner select.
Run it alone to = see.


= --Apple-Mail=_43D2A229-24A5-4E40-A91F-024FF62B29F6--