存储过程中 group by 的情况
是否可以在组中处理一个案例? 与此类似:
select * from table
GROUP BY
CASE WHEN @Attivita=0 THEN (RANK() OVER (GROUP BY Nome,AccountID,Matricola DESC))
END
谢谢
is possible do a case in a group by?
similar to this:
select * from table
GROUP BY
CASE WHEN @Attivita=0 THEN (RANK() OVER (GROUP BY Nome,AccountID,Matricola DESC))
END
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须按所有选定的(非聚合)列进行分组。
因此,如果您
选择*
,您将需要按所有这些列进行分组...如果不是
group by
你的意思是order by
那么是的,你可以..you have to group by all selected (non-aggregated) columns..
so if you
select *
you will need to group by all of them ...If instead of
group by
you meanorder by
then yes you can..不:这没有任何意义。
您不能
您想做什么,请使用输入/输出和模式。
根据加比的回答进行编辑
No: this would make no sense.
You can't
What are you trying to do, with input/output and schema please.
Edit, based on gaby's answer