我想知道当多个分组依据(例如,按列名称(1),列名称(2),列名称(3)分组)时如何工作

时间:2019-04-29 01:42:01

标签: sql group-by inner-join

当我检查它时,它不会删除重复的值。为什么?

示例)Group by aGroup by a,b,c

Group by aGroup by a,b,c之间有区别吗?

我这样写SQL查询::

SELECT COUNT(CustomerID), Country
FROM Customers
GROUP BY Country; 

结果::

Table: Customers

COUNT(CustomerID)   Country
---------------------------------
        3           Argentina        
        2           Austria
        2           Belgium
        9           Brazil
        3           Canada
        2           Denmark
        2           Finland

SELECT COUNT(CustomerID), Country
FROM Customers
GROUP BY Country, CustomerID; 
Table: Customers

COUNT(CustomerID)   Country
---------------------------------
        1           Germany        
        1           Mexico
        1           Mexico
        1           UK
        1           Sweden
        1           Germany
        1           France

为什么不绑定来自Column_name的相同值更改的查询? 它沿column_name显示所有值。 我想知道是否行得通。谢谢。

0 个答案:

没有答案