怎么分组没有发生在这里?

时间:2017-06-30 09:58:49

标签: oracle oracle11g

此代码有什么问题?

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;

1 个答案:

答案 0 :(得分:2)

group by会自动为每个不同的分组列排列生成一行。因此,distinct的使用是多余的,语法无效。

 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;