Sorting based on maximum value over several columns

From: "Net Virtual Mailing Lists" <mailinglists(at)net-virtual(dot)com>
To: "Pgsql General" <pgsql-general(at)postgresql(dot)org>
Subject: Sorting based on maximum value over several columns
Date: 2004-11-07 00:31:59
Message-ID: 20041107003159.11646@mail.net-virtual.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

Lets say I have data like this:

value1|value2|value3|value4|....|value(N)
------|------|------|------|----|--------
100 | 200 | 300 | 400 | |
10 | 20 | | 40 | |
| 15 | | 16 | |
5 | | | | |

Now I want to sort these based on the maximum value of the data in each
row, so for sorting purposes I would have this:

sort
----
400
40
16
5

Any ideas?... I've tried several things but none of them have given me
the result I am after....

Thanks as always!

- Greg

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Devin L. Ganger 2004-11-07 01:14:19 Re: Postresql RFD version 2.0 Help Wanted.
Previous Message Tom Lane 2004-11-06 23:47:01 Re: Trying to get postgres to use an index