SQL子句“GROUP BY 1”是什么?意思? [英] What does SQL clause "GROUP BY 1" mean?

查看:169
本文介绍了SQL子句“GROUP BY 1”是什么?意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人向我发送了一个SQL查询,其中 GROUP BY 子句由以下语句组成: GROUP BY 1

Someone sent me a SQL query where the GROUP BY clause consisted of the statement: GROUP BY 1.

这肯定是一个错字吗?没有列给别名1.这意味着什么?我是否有权假定这必定是一个错字?

This must be a typo right? No column is given the alias 1. What could this mean? Am I right to assume that this must be a typo?

推荐答案

它意味着按第一列进行分组,无论名称是什么。你可以用 ORDER BY 来做同样的事情。

It means to group by the first column regardless of what it's called. You can do the same with ORDER BY.

这篇关于SQL子句“GROUP BY 1”是什么?意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆