Received: from ww2.truenet-ce.com.br (IDENT:root@truenet-ce.com.br [200.239.122.1]) by hub.org (8.9.2/8.9.1) with ESMTP id RAA05477; Wed, 10 Feb 1999 17:52:59 -0500 (EST) (envelope-from pulsar@truenet-ce.com.br) Received: from rcoelho.truenet-ce.com.br ([200.239.122.28]) by ww2.truenet-ce.com.br (8.9.1/8.7.3) with SMTP id TAA29499; Wed, 10 Feb 1999 19:55:38 -0200 Received: by localhost with Microsoft MAPI; Wed, 10 Feb 1999 19:49:05 -0200 Message-ID: <01BE552E.6A2F64A0.pulsar@truenet-ce.com.br> From: "Ricardo J.C.Coelho" To: "'Bob Kruger'" , "pgsql-sql@postgreSQL.org" , "pgsql-general@postgreSQL.org" Subject: RES: [GENERAL] Select max field Date: Wed, 10 Feb 1999 19:40:27 -0200 X-Mailer: Microsoft Internet E-mail/MAPI - 8.0.0.4211 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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