From: Douglas Nichols <dnichols@fhcrc.org>
To: pgsql-sql@postgresql.org
Subject: sql question: min remapped value
Date: Thu, 18 Nov 1999 23:26:24 +0000
Message-ID: <38348B20.6A4F8EF1@fhcrc.org> (raw)
I am trying to remap a field find the row with the minimum value and
then keep the original value and the id number from that row something
like this:
mydata (id, field1)
field1 can = 0,1,2,3,4,5
but I reallt need them ordered like this (1=2, 0=2, 3=4, 4=5, 5=0)
once I find the lowest remapped value I need to know id & field1
I was looking at something like
select id, field1, min(decode(field1,1,1,0,2,3,4,4,5,0)) as flag
from mydata
group by id;
Any help is appreciated and thanks ahead!
Cheers, dn
Douglas Nichols dnichols@fhcrc.org
---------------------------------------------------------------
National Wilms Tumor Study Group 206.667.4283
Seattle, WA
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: dnichols@fhcrc.org
Subject: Re: sql question: min remapped value
In-Reply-To: <38348B20.6A4F8EF1@fhcrc.org>
References: <38348B20.6A4F8EF1@fhcrc.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox