user6839040
user6839040

Reputation:

How grouping not happening here?

What is wrong with this code?

Select Distinct(Output), Max(x.Senddate)
  From Url_Response x
 Where Upper(x.Output) Not Like '%SUCCESS%'
 Group By Distinct(Output)
 Order By 1 Desc;

Upvotes: 0

Views: 22

Answers (1)

APC
APC

Reputation: 146239

group by automatically produces one row per distinct permutation of the grouping columns. So your use of distinct is redundant as well as syntactically invalid.

 Select x.Output, Max(x.Senddate) 
 From Url_Response x
 Where Upper(x.Output) Not Like '%SUCCESS%' 
 Group By x.Output 
 Order By 1 Desc;

Upvotes: 2

Related Questions