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 error

Author  Topic 

sql2020
Yak Posting Veteran

54 Posts

Posted - 2010-10-29 : 07:52:17
select Modified_Date,Request_Id,Short_Description,Company,Service_Categorization_Tier_1,Service_Categorization_Tier_2,Service_Categorization_Tier_3,Support_Company,Support_Organization,Support_Group,Name,Part_of_Custom_Group,Component,Interface_name from MER_CGI_Middleware_Error_Confi where error_type like 'Serveur Down'
--and Interface_name like 'People Interface'
group by Interface_name


it shows this error


Msg 8120, Level 16, State 1, Line 2
Column 'MER_CGI_Middleware_Error_Confi.Modified_Date' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.


help on this

sql2020

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-10-29 : 08:09:21
http://weblogs.sqlteam.com/jeffs/archive/2007/07/20/but-why-must-that-column-be-contained-in-an-aggregate.aspx


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

shaggy
Posting Yak Master

248 Posts

Posted - 2010-10-29 : 08:14:33
i dont understand what ur trying to get

i suppose, u want to get the distinct of rows try include all columns of select in group by clause
Go to Top of Page

sql2020
Yak Posting Veteran

54 Posts

Posted - 2010-10-29 : 08:27:47
Not distinct

i want max(date) with in that group


sql2020
Go to Top of Page

shaggy
Posting Yak Master

248 Posts

Posted - 2010-10-29 : 09:04:24
select MAX(date)) over( partition by Interface_name),* from Schedule
where error_type like 'Serveur Down'

try this
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-10-29 : 09:24:05
Don't use LIKE when not using jokers.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -