View Single Post
  #2 (permalink)  
Old 04-20-2006, 12:15 AM
ben ben is offline
Administrator
 
Join Date: Mar 2007
Posts: 87
ben has disabled reputation
Default Postgresql answer. Re: Find the minimum or maximum value across several columns?

Postgresql has two commands that come in handy, one is greatest() the other least()

[sql]
SELECT max(greatest(col1, col2) FROM table
SELECT min(least(col1, col2) FROM table
[/sql]
Reply With Quote