Group by with insensitive order - Mailing list pgsql-general

From Aram Fingal
Subject Group by with insensitive order
Date
Msg-id 6DC89F55-57BA-489C-ADF9-9AF09BE1CE28@multifactorial.com
Whole thread Raw
Responses Re: Group by with insensitive order  (hubert depesz lubaczewski <depesz@depesz.com>)
Re: Group by with insensitive order  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Suppose I'm doing a group by query like the following:

SELECT drug1, drug2, AVG(response)
FROM data
GROUP BY drug1, drug2

The problem is that the same drug may appear sometimes as drug1 and sometimes as drug2.  So, for example, the
combination"aspirin, acetaminophen" may also appear as "acetaminophen, aspirin" and I want these grouped together in
thequery.  Is there a simple way to do this? 

--Aram Fingal

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Error during a dump (ts_selectivity, not found)
Next
From: Magnus Hagander
Date:
Subject: Re: PostgreSQL 9.0.1 PITR can not copy WAL file