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 1hwkUy-0002fI-CI for pgsql-general@arkaria.postgresql.org; Sun, 11 Aug 2019 09:50:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hwkUu-0001Dm-T0 for pgsql-general@arkaria.postgresql.org; Sun, 11 Aug 2019 09:50:44 +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 1hwkUu-0001De-JV for pgsql-general@lists.postgresql.org; Sun, 11 Aug 2019 09:50:44 +0000 Received: from mailbackend.panix.com ([166.84.1.89]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hwkUn-0003u1-LN for pgsql-general@postgresql.org; Sun, 11 Aug 2019 09:50:41 +0000 Received: from panix2.panix.com (panix2.panix.com [166.84.1.2]) by mailbackend.panix.com (Postfix) with ESMTP id 465vNn2v4Yz1JN3 for ; Sun, 11 Aug 2019 05:50:33 -0400 (EDT) Received: by panix2.panix.com (Postfix, from userid 17622) id 465vNn22Gbz1ZVM; Sun, 11 Aug 2019 05:50:33 -0400 (EDT) Date: Sun, 11 Aug 2019 05:50:33 -0400 From: stan To: pgsql-general@postgresql.org Subject: Re: Probably a newbie question Message-ID: <20190811095033.GB24104@panix.com> References: <20190810185714.GA23952@panix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190810185714.GA23952@panix.com> X-Editor: gVim User-Agent: Mutt/1.12.1 (2019-06-15) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sat, Aug 10, 2019 at 02:57:14PM -0400, stan wrote: > Sorry, I got the list address wrong the first time, and when I corrected it, > I forget to fix the subject line. > > I apologize for asking, what I suspect will turn out to be a newbie > question, but I have managed to get myself quite confused on this. > > I am defining a view as follows > > > CREATE OR REPLACE view purchase_view as > select > project.proj_no , > qty , > mfg_part.mfg_part_no , > mfg.name as m_name , > mfg_part.descrip as description , > ( > SELECT > name > FROM > vendor > WHERE > bom_item.vendor_key = > ( > SELECT > vendor_key > FROM > mfg_vendor_relationship > WHERE > bom_item.mfg_key = mfg_key > AND > prefered = TRUE > AND > bom_item.project_key = project_key > > ) > ) > as v_name , > /* > vendor.name as v_name , > */ > cost_per_unit , > costing_unit.unit, > need_date , > order_date , > recieved_date , > po_no , > po_line_item > from > bom_item > right join project on > project.project_key = bom_item.project_key > inner join mfg_part on > mfg_part.mfg_part_key = bom_item.mfg_part_key > inner join vendor on > vendor.vendor_key = bom_item.vendor_key > inner join costing_unit on > costing_unit.costing_unit_key = bom_item.costing_unit_key > inner join mfg on > mfg.mfg_key = bom_item.mfg_key > WHERE bom_item is NOT NULL > ORDER BY > project.proj_no , > mfg_part > ; > Thanks to the kind, bright people on this list, I have solved my problem. The basic issue was that my from clause was on the wrong table. Thanks to everyone who spent their time helping me out on this! -- "They that would give up essential liberty for temporary safety deserve neither liberty nor safety." -- Benjamin Franklin