Re: Get COUNT results from two different columns

From: Ray O'Donnell <ray(at)rodonnell(dot)ie>
To: cliveswan(at)gmail(dot)com, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Get COUNT results from two different columns
Date: 2021-09-23 13:47:12
Message-ID: 38fe6b0d-8958-68a2-dd65-81451a8c957a@rodonnell.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 23/09/2021 14:37, Clive Swan wrote:
> Greetings,
>
> I have two separate queries that work individually, returning a count
> from each column.
>
> I want to subtract New(COUNT) from Old(Count)
>
> I get an error when trying to run UNION?

At a quick guess, you'll need to move the subtraction outside the two
subqueries - stuff inside either query can't see anything in the other one.

Ray.

--
Raymond O'Donnell // Galway // Ireland
ray(at)rodonnell(dot)ie

In response to

Browse pgsql-general by date

  From Date Subject
Next Message SQL Padawan 2021-09-23 13:50:20 RE: Get COUNT results from two different columns
Previous Message Clive Swan 2021-09-23 13:37:11 RE: Get COUNT results from two different columns