Re: Change detection - Mailing list pgsql-sql

From Rob Sargent
Subject Re: Change detection
Date
Msg-id 04759d61-3782-2787-5d66-3bc93bfc4230@gmail.com
Whole thread Raw
In response to Re: Change detection  (Shaozhong SHI <shishaozhong@gmail.com>)
List 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.




pgsql-sql by date:

Previous
From: Shaozhong SHI
Date:
Subject: Re: Change detection
Next
From: Shane Borden
Date:
Subject: PARALLEL CTAS