Jun21

Written by:David Aldridge
6/21/2011 3:59 PM 

This is done using the greatest() and least() functions respectively.  So to find the max across three columns then you would use something like:

select greatest(col1,col2,col3) from mytable;

To find the minimum you would use:

select least(col1,col2,col3) from mytable;

Tags:

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment  Cancel 
You must be logged in and have permission to create or edit a blog.