Home » SQL & PL/SQL » SQL & PL/SQL » Get the maximum value per row (How to get the maximum value of several comlumns per row)
Get the maximum value per row [message #273185] Tue, 09 October 2007 07:08 Go to next message
greatmacoy
Messages: 3
Registered: October 2007
Junior Member
Hi!

Assuming I have a table with 5 numeric columns. How can I retrieve the highest value from the five columns in each row (record)?

The result of the query should be a single [highest] value from each record.

Your help would be grately appreciated.

Many thanks in advance,

macoy

[Updated on: Tue, 09 October 2007 07:11]

Report message to a moderator

Re: Get the maximum value per row [message #273188 is a reply to message #273185] Tue, 09 October 2007 07:14 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
You want to use the GREATEST function.
Re: Get the maximum value per row [message #273331 is a reply to message #273188] Wed, 10 October 2007 00:28 Go to previous message
greatmacoy
Messages: 3
Registered: October 2007
Junior Member
Thanks a lot!
Previous Topic: Multiple 'OF' clauses in a trigger?
Next Topic: To fetch record using DECODE
Goto Forum:
  


Current Time: Mon Feb 17 20:14:28 CST 2025