pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Emi Lu <emilu@encs.concordia.ca>
To: pgsql-sql@postgresql.org
Subject: Get the max(value1, value2, value3) from a table
Date: Mon, 07 Jan 2008 17:03:30 -0500
Message-ID: <4782A1B2.5050804@encs.concordia.ca> (raw)

Greetings,

Version: PostgreSQL 8.0.13 on i686-pc-linux-gnu

I have a table test(col1, col2, col3)

For each row, I'd like to get the "max"(col1, col2, col3).

For example, test(1, 5, 2)
              test(8, 1, 3)
              test(12, 1, 1)


select ?max?(col1, col2, col3) as result;
will return

result
-------
5
8
12

(3 rows)

Thanks!
Ly.



view thread (11+ messages)  latest in thread

Message-ID: <4782A1B2.5050804@encs.concordia.ca>
Permalink:  ../4782A1B2.5050804@encs.concordia.ca/
Also on:    postgresql.org/message-id/4782A1B2.5050804@encs.concordia.ca

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: emilu@encs.concordia.ca
  Subject: Re: Get the max(value1, value2, value3) from a table
  In-Reply-To: <4782A1B2.5050804@encs.concordia.ca>

* 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