Solved

Getting max value in oracle

Posted on 2008-10-06
5
529 Views
Last Modified: 2013-12-18
Hello All,

I have a table with 4 columns.

Table A
Column1, Column2, COlumn3, Column4

I want to get Column1 and the max value of Column2, Column3, COlumn4. Can some one please provide me with an example on how to do this.

I am writing this query against Oracle database.

Any help is appreciated.

Thanks,
SRM.
0
Comment
Question by:SRM19
  • 3
  • 2
5 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22654001
that looks like:
SELECT Column1, MAX(Column2), MAX(Column3), MAX(Column4) FROM TABLE_A GROUP BY Column1 
but you might not have told the entire story?

Open in new window

0
 

Author Comment

by:SRM19
ID: 22654071
angell, thanks for the solution but that is not what I am looking for. I want the max of 3 columns(column2, column3, column4)
something like this max(column2, column3, column4).

Thanks.
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 22654106
I see
SELECT Column1, GREATEST(Column2, Column3 , Column4) FROM TABLE_A  

Open in new window

0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22654110
0
 

Author Comment

by:SRM19
ID: 22654192
thanks angellll, it worked great.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Convert Oracle data into XML document 2 65
Bash Script to Analyze Oracle Schemas 11 103
clob to char in oracle 3 38
SQL Developer 6 48
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question