Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query problem when using MAX

Author  Topic 

lmattox
Starting Member

1 Post

Posted - 2011-10-06 : 15:40:27
I am getting an error with this query, but I can't seem to find out what is causing it.

SELECT Month,Year, MAX(SystemPeak) AS MPeak FROM SysOpsPeak

Also, it works great as:

SELECT Month,Year, SystemPeak FROM SysOpsPeak

So I think it must be something wrong when I try to use MAX. The column SystemPeak is an Decimal.

pduffin
Yak Posting Veteran

68 Posts

Posted - 2011-10-06 : 15:44:03
You need a group
Go to Top of Page

pduffin
Yak Posting Veteran

68 Posts

Posted - 2011-10-06 : 15:44:52
SELECT Month,Year, MAX(SystemPeak) AS MPeak
FROM SysOpsPeak
group by Month,Year
Go to Top of Page
   

- Advertisement -