Re: Change detection
| От | Rob Sargent |
|---|---|
| Тема | Re: Change detection |
| Дата | |
| Msg-id | 04759d61-3782-2787-5d66-3bc93bfc4230@gmail.com обсуждение исходный текст |
| Ответ на | Re: Change detection (Shaozhong SHI <shishaozhong@gmail.com>) |
| Список | 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 по дате отправления: