RE: Get COUNT results from two different columns

Поиск
Список
Период
Сортировка
Искать
От
Clive Swan
Тема
RE: Get COUNT results from two different columns
Дата
Msg-id
003e01d7b08d$fbe00980$f3a01c80$@gmail.com
Ответ на
Список
Дерево обсуждения
RE: Get COUNT results from two different columns "Clive Swan" <cliveswan@gmail.com>
Re: Get COUNT results from two different columns Ray O'Donnell <ray@rodonnell.ie>
Re: Get COUNT results from two different columns Marc Olivé <marc.olive@iomed.es>
Re: Get COUNT results from two different columns "David G. Johnston" <david.g.johnston@gmail.com>
RE: Get COUNT results from two different columns "Clive Swan" <cliveswan@gmail.com>
RE: Get COUNT results from two different columns SQL Padawan <sql_padawan@protonmail.com>
RE: Get COUNT results from two different columns "Clive Swan" <cliveswan@gmail.com>
Greetings,

Thanks for the message.

The error message that I get is.

ERROR: 
subquery in FROM must have an alias
  Hint: For example, FROM (SELECT ...) [AS] foo.
  Position: 100

Trying to make sense of it..

Clive

-----Original Message-----
From: SQL Padawan [mailto:sql_padawan@protonmail.com] 
Sent: 23 September 2021 14:50
To: cliveswan@gmail.com
Cc: pgsql-general@lists.postgresql.org
Subject: RE: Get COUNT results from two different columns


Hi,


> I have two separate queries that work individually, returning a count from each column.

> I would appreciate any pointers.

>     new_sup,  COUNT(new_sup) AS new_sup_count

>     old_sup,  COUNT(old_sup) AS old_sup_count

At least some of your problem is here - in your UNION-ed table, this is one and the same field and therefore cannot have two different names.


HTH,

SQL Padawan




В списке pgsql-general по дате отправления
От: Marc Olivé
Дата:
От: rihad
Дата:
FAQ