From: | Josh Berkus <josh(at)agliodbs(dot)com> |
---|---|
To: | "Dan Winslow" <d(dot)winslow(at)cox(dot)net>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Diffcult query |
Date: | 2003-03-21 19:45:58 |
Message-ID: | 200303211145.58768.josh@agliodbs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Dan,
> Hi folks. This is giving me fits. I feel like it oughta be simple, but
> apparantly its not...I think.
> I need a ( preferably single ) query that will sum the costs for all unique
> pairs of codes, without regard to column order. That is, for summing
> purposes, rows 1 and 3 are identical, and should produce the sum of 8 for
> the unordered pair("aaa","bbb"). It should also, of course, prevent the case
> where ("bbb","aaa") is considered a seperate pair. Any ideas would be much
> appreciated.
It's not simple, because your DB design is poorly normalized. My first
suggestion would be to make some design changes to your schema. Is that
possible?
--
-Josh Berkus
Aglio Database Solutions
San Francisco
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2003-03-21 20:13:33 | Re: |
Previous Message | Achilleus Mantzios | 2003-03-21 19:20:01 | Re: cast of integer to bool doesn't work (anymore?) |