From: Ricardo J.C.Coelho <pulsar@truenet-ce.com.br>
To: 'Bob Kruger' <bkruger@mindspring.com>
To: pgsql-sql@postgreSQL.org <pgsql-sql@postgreSQL.org>
To: pgsql-general@postgreSQL.org <pgsql-general@postgreSQL.org>
Subject: RES: [GENERAL] Select max field
Date: Wed, 10 Feb 1999 19:40:27 -0200
Message-ID: <01BE552E.6A2F64A0.pulsar@truenet-ce.com.br> (raw)
Bob,
I think MAX aggregate function choose the maximum values of one field (or expression) in a set of rows. Not the max vaues of many fields.
----- Mensagem original -----
De: Bob Kruger [SMTP:bkruger@mindspring.com]
Enviada em: Quarta-feira, 10 de Fevereiro de 1999 16:43
Para: pgsql-sql@postgreSQL.org; pgsql-general@postgreSQL.org
Assunto: [GENERAL] Select max field
I am looking for a way to determine the largest value of a number of fields
in a tuple.
Example: In a table with the fields id_no, t1, t2 ,t3 ,t4 ,t5
Select the id_no and the greatest value from fields t1, t2, t3,
t4, t5.
I have tried the following, but with no success:
select id_no, max(t1, t2, t3, t4, t5) from table_1 ;
Anyone have any suggestions?
Thanks in advance for any assistance.
Regards - Bob
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: pulsar@truenet-ce.com.br, bkruger@mindspring.com, pgsql-general@postgreSQL.org
Subject: Re: [GENERAL] Select max field
In-Reply-To: <01BE552E.6A2F64A0.pulsar@truenet-ce.com.br>
References: <01BE552E.6A2F64A0.pulsar@truenet-ce.com.br>
* 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