Home » RDBMS Server » Server Administration » Re: Returning 2 values with Max function
Re: Returning 2 values with Max function [message #370814] Thu, 10 February 2000 14:35 Go to next message
Nell
Messages: 7
Registered: February 2000
Junior Member
Hi, thanks so much for responding. I tried every select statement in your reply but I am not getting the result. The first one I got the message "Not a single group group function". And with the second one I am getting the same result with what I had before. What I am getting is simply just a column of values in desc order. Is it how Max function works? I only want the one record which has the max value. I did this(following your second sample):

Select DeptID, Month, Amt
From tblSales
where Amt in
(Select Max(Amt)
From tblSales group by DeptID, Month)
and DeptID=123;

The result I got was
DeptID Month Amt
123 Jan 300
123 Feb 200
123 March 100

What I want is:
DeptID Month Amt
123 Jan 300

Did I do anything wrong? Thanks again.
Re: Returning 2 values with Max function (New One) [message #370827 is a reply to message #370814] Fri, 11 February 2000 15:05 Go to previous message
Nell
Messages: 7
Registered: February 2000
Junior Member
Yeap, thaat's itttt!!!!!!
Thanks Rehman so much!!!!!!!!!!!!!!!!
Previous Topic: Cumulative value
Next Topic: Re: Why so slow?
Goto Forum:
  


Current Time: Wed Oct 21 11:56:05 CDT 2020