Re: aggregation question - Mailing list pgsql-general

From David Rowley
Subject Re: aggregation question
Date
Msg-id CAKJS1f-7HhYLcDm7vHQSAT2XwkmWXSEfBNE8F0nuYH5W5NEesg@mail.gmail.com
Whole thread Raw
In response to aggregation question  (Chris Withers <chris@simplistix.co.uk>)
Responses Re: union/difference/intersection question  (Chris Withers <chris@simplistix.co.uk>)
List pgsql-general
On 9 December 2015 at 00:44, Chris Withers <chris@simplistix.co.uk> wrote:
Hi All,

I hope this is quite a simple one...

I have a fixtures table containing home_club and away_club, and I'd like to select the distinct list of clubs contained in all rows but in either the home_club or away_club columns.

How would I do that?

Use UNION:

select home_club from fixtures UNION select away_club from fixtures; 

--
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

pgsql-general by date:

Previous
From: Chris Withers
Date:
Subject: aggregation question
Next
From: Chris Withers
Date:
Subject: Re: union/difference/intersection question