Re: Syntax error needs explanation [RESOLVED]

Поиск
Список
Период
Сортировка
От Rich Shepard
Тема Re: Syntax error needs explanation [RESOLVED]
Дата
Msg-id f831272d-ac28-489-cdbe-356c78bb87d5@appl-ecosys.com
обсуждение исходный текст
Ответ на Re: Syntax error needs explanation  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
On Mon, 14 Jul 2025, David G. Johnston wrote:

> Yeah, you need both to read up on aggregate queries and correlated
> subqueries which is typically how one makes uses of exists (it's called a
> semi-join in this formulation)

David,

Thanks. I wasn't sure what to read.

> Not tested, but:
>
> select c.industry, count(*)
> from companies as c
> where exists (
> select from enforcement as e
> where e.company_nbr = c.company_nbr
> )
> group by c.industry;

Works as intended.

Many thanks,

Rich



В списке pgsql-general по дате отправления: