Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s8LN6-00Bvp4-SB for pgsql-general@arkaria.postgresql.org; Sat, 18 May 2024 14:49:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s8LN6-006smD-TV for pgsql-general@arkaria.postgresql.org; Sat, 18 May 2024 14:49:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s8LN5-006sks-LT for pgsql-general@lists.postgresql.org; Sat, 18 May 2024 14:49:16 +0000 Received: from srv01.teladesign.ie ([2001:41c9:1:41d::10]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s8LN0-000pXv-Au for pgsql-general@lists.postgresql.org; Sat, 18 May 2024 14:49:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=rodonnell.ie; s=exim; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: From:References:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:Cc: Content-ID:Content-Description:Resent-Message-ID; bh=Qr+3RpkXnM5ip7aLp7Rg0nGZWy4pU6hoSl95Hm5wwBI=; b=IZwOJFmYdoPIBz/EfwvCL3U0Po vlrKhtBZC99/xQune1crZYDgclHAEIeLRqtaJVF383TquyP/V93LU9hEm5G8s678pgxMYRj2dmNlf p3yJBhsDQnRFSpw2Nb3+TsGOWrkOBp5DhpMcGz21uMPK7D53EFVHZs2jmN8a6K6ONO58=; Received: from [64.43.146.234] (helo=[192.168.1.162]) by srv01.teladesign.ie with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1s8LMt-0005CQ-Hr; Sat, 18 May 2024 15:49:04 +0100 Message-ID: Date: Sat, 18 May 2024 15:49:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Left join syntax error To: Rich Shepard , pgsql-general@lists.postgresql.org References: <2c877258-61cc-dd2d-fac7-4f2a5c6293e7@appl-ecosys.com> <9d899286-3a73-4894-a6e0-eab529c92e65@gmx.net> <3216489-758a-faef-b21b-84c9679f53c@appl-ecosys.com> Content-Language: en-GB From: Ray O'Donnell In-Reply-To: <3216489-758a-faef-b21b-84c9679f53c@appl-ecosys.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 18/05/2024 15:46, Rich Shepard wrote: > On Sat, 18 May 2024, Shammat wrote: > >> Don't put the second table in the FROM part >> >> SELECT p.lname, p.fname, p.job_title, p.company_nbr, p.email, >> c.company_name >> FROM people as p >>  LEFT JOIN companies as c ON c.company_nbr = p.company_nbr > > Shammat, > > I tried this with this result: > > ERROR:  missing FROM-clause entry for table "c" > LINE 3: LEFT JOIN companies ON c.company_nbr = p.company_nbr; > You need to include the alias for the table also - see "...from companies as c..." in Shammat's example. Ray. -- Raymond O'Donnell // Galway // Ireland ray@rodonnell.ie