Solved

sql query with 2 Max parameters

Posted on 2014-03-22
4
464 Views
Last Modified: 2014-03-23
Hi Experts

Using an sql query I want to get a particular column value for a row that has MAX values in 2 other columns, something like:

SELECT FloatAmount, MAX(CountDate), MAX(CountDateNumber)
FROM Count


Has anyone got any idea how to do this?
0
Comment
Question by:dizzycat
  • 2
4 Comments
 
LVL 41

Accepted Solution

by:
pcelba earned 500 total points
ID: 39947733
If these two max values are in different rows then you have no solution...
If you have duplicate max values then you have many solutions...

SELECT FloatAmount, CountDate, CountDateNumber FROM Count
WHERE CountDate = (SELECT MAX(CountDate) FROM Count)
  AND CountDateNumber = (SELECT MAX(CountDateNumber) FROM Count)

So you have to better specify what is your goal.
0
 

Author Closing Comment

by:dizzycat
ID: 39947741
That's great, thanks.
0
 
LVL 68

Expert Comment

by:Qlemo
ID: 39947762
You should have waited for better suggestions ;-).
0
 
LVL 41

Expert Comment

by:pcelba
ID: 39948715
You may still post them :-)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Read about achieving the basic levels of HRIS security in the workplace.
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now