RE: Get COUNT results from two different columns - Mailing list pgsql-general

From SQL Padawan
Subject RE: Get COUNT results from two different columns
Date
Msg-id P_uiZUR4inQ8pRoFheaMsOm9ho0Eo6F8tO3rSbdLRQo-vexNeohsVfUrk2d0YJFqrEejlH4yt6PfShetrVrpDbDmaOxKnbmZ2JXUdYq2MdQ=@protonmail.com
Whole thread Raw
In response to RE: Get COUNT results from two different columns  ("Clive Swan" <cliveswan@gmail.com>)
Responses RE: Get COUNT results from two different columns  ("Clive Swan" <cliveswan@gmail.com>)
List pgsql-general
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
havetwo different names. 


HTH,

SQL Padawan





pgsql-general by date:

Previous
From: Ray O'Donnell
Date:
Subject: Re: Get COUNT results from two different columns
Next
From: Marc Olivé
Date:
Subject: Re: Get COUNT results from two different columns