Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1onMI8-0007uN-4B for pgsql-general@arkaria.postgresql.org; Tue, 25 Oct 2022 15:56:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1onMI6-0007O0-1n for pgsql-general@arkaria.postgresql.org; Tue, 25 Oct 2022 15:56:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1onMI5-0007Nq-Jh for pgsql-general@lists.postgresql.org; Tue, 25 Oct 2022 15:56:33 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1onMI2-0002pd-MI for pgsql-general@lists.postgresql.org; Tue, 25 Oct 2022 15:56:33 +0000 Received: by mail-pf1-x42c.google.com with SMTP id g62so8210708pfb.10 for ; Tue, 25 Oct 2022 08:56:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=X+KhJocFxi3fdvOTBeLkZ8R6OhM3cTpagUnJ6b0+VlA=; b=k082hJfh/L4icaPZEtE17s5H63RxSEn773WObar8+vzxF8odC5Jrj+gNGYvyOW6qEq 0UXU3YlYLPdGJDxHnyKJ/zp8fqYs6DelkdOXVmrwgiok8cnI3KqHR6NPiPlpbhKXFsm+ 7oL1wZPqSCqnwY/kVLwIyHUUWoqVj0Ky9Z1bzqAxtSmQGHTuChPQVFNy7VsI6uNb/TvP awVTMeDZdTThr2kgz7O7viaBPmEbG+K8UtgdKWiV8x/gX/w9Q8q6um0u5C4ZebmUuPce ID8PwPxV0MqBYVzbQMhpOGt4XJvZ3ZjZE/Eqxzj1jP9bFrCr8oKz7Zck/KmXUXaVnVkL 2Zlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=X+KhJocFxi3fdvOTBeLkZ8R6OhM3cTpagUnJ6b0+VlA=; b=aQL4DhpeH0uds6fQM9tESEvtv7AfDgL5iarHTJVwJppYReon0vsLh/s1fXFK5BqXiy 9ZzJZzvk9pr5NPbJXgWDLCDeUI8LyjmzWmxgnyg6FoRVNBbqlwFqnEQXdAlV5ur+n57z TK0H6hX2pr+dVEqZd7vr6XiiAQ6DIxSqkbEjjX6Uga595oxq6q04CGIeRuG4q+3OKCnM xOQnLke/usJ5Rd8iXy0tGtg1bfEvWZc6fAD3OUGvry/VUK8B4pNx4R4RFEDE4IZspwQP 1Or2LJXpSGkQ1Qmst6RrygyNMHc/QhI7IDqz2cAPgBZkZJPtbGXlco7qdWHY3lL6ccwq 56cg== X-Gm-Message-State: ACrzQf3XMCLpPxZmdMwRpb3YlpBOiC7u5Tny577C3YEwmUL9gZa9O35l KhMcIG069/ShGlseFFVnwiw= X-Google-Smtp-Source: AMsMyM6u+R03nG2cObQ/tB5Psy55PfcU+Lt19H+rH8SeNIexFzNKUENGDbprcXVcQuGURYEVguw+cA== X-Received: by 2002:a63:4d0b:0:b0:46e:ce48:f008 with SMTP id a11-20020a634d0b000000b0046ece48f008mr16525879pgb.123.1666713388303; Tue, 25 Oct 2022 08:56:28 -0700 (PDT) Received: from ?IPV6:2601:681:5a00:f790:5d5d:578b:8f10:84a6? ([2601:681:5a00:f790:5d5d:578b:8f10:84a6]) by smtp.gmail.com with ESMTPSA id om10-20020a17090b3a8a00b00212daa68b7csm5639040pjb.44.2022.10.25.08.56.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 Oct 2022 08:56:27 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------M9c4HeBdLOVvvu28e9QkUzML" Message-ID: <9743c2b4-86b9-944d-ca48-6fa73439d70b@gmail.com> Date: Tue, 25 Oct 2022 09:56:26 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: please give me select sqls examples to distinct these! Content-Language: en-CA To: "David G. Johnston" Cc: jacktby@gmail.com, pgsql-general References: <202210252154573516405@gmail.com> <8E137936-5D93-49FF-93A3-EB4E97D3416C@gmail.com> From: Rob Sargent In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------M9c4HeBdLOVvvu28e9QkUzML Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 10/25/22 09:24, David G. Johnston wrote: > On Tue, Oct 25, 2022 at 8:22 AM David G. Johnston > wrote: > > On Tue, Oct 25, 2022 at 7:06 AM Rob Sargent > wrote: > > > > 2: select * from table join table b on Id = idb > > > > #2 is probably conceptually correct but in this context should be > written as: > > > Actually, a join is NOT conceptually correct here - the output columns > for "SELECT *" will be wrong. > > David J. > OK.  TBH I thought this was the JOOQ list! Didn't notice the typedef.  So this is all about exact match "tables". I suppose my #2 could be framed as select a* from table as a join table as b on a. = b. to be a functional equivalent of INTERSECT? --------------M9c4HeBdLOVvvu28e9QkUzML Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
On 10/25/22 09:24, David G. Johnston wrote:
On Tue, Oct 25, 2022 at 8:22 AM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Tue, Oct 25, 2022 at 7:06 AM Rob Sargent <robjsargent@gmail.com> wrote:


2: select * from table join table b on Id = idb 



#2 is probably conceptually correct but in this context should be written as:


Actually, a join is NOT conceptually correct here - the output columns for "SELECT *" will be wrong.

David J.

OK.  TBH I thought this was the JOOQ list! Didn't notice the typedef.  So this is all about exact match "tables".

I suppose my #2 could be framed as
   
select a* from table as a join table as b on a.<criteria> = b.<criteria>
to be a functional equivalent of INTERSECT?

--------------M9c4HeBdLOVvvu28e9QkUzML--