Re: Change detection

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: pgsql-sql(at)lists(dot)postgresql(dot)org
Subject: Re: Change detection
Date: 2022-12-09 19:38:07
Message-ID: 04759d61-3782-2787-5d66-3bc93bfc4230@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 12/9/22 12:32, Shaozhong SHI wrote:
> That works well.
>
> I just wonder whether we can tell Tom or Tim has worked in more than 1
> department.  Apparently, PostgreSQL does not allow count(distinct
> department) when window function is used.
>
> Given this data set, can we do something like count(distinct) to
> provide an answer to how many different department someone has worked in?
>
> Regards,
>
> David
Use the working query in a CTE and simply do the count(distinct
department) on that, else there's no good place to put the number of
departments per person.

Pretty sure you've been asked before but Please don't top post.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Shane Borden 2022-12-12 16:16:49 PARALLEL CTAS
Previous Message Shaozhong SHI 2022-12-09 19:32:48 Re: Change detection