Re: Returning 2 values with Max function [message #370814] |
Thu, 10 February 2000 14:35 |
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.
|
|
|
|