SQL COUNT未以数字形式返回。它似乎以字符串形式返回。
SELECT
Count (StateProvince)
FROM
CUSTOMER
JOIN
INVOICE ON CustomerID = FK_CustomerID
GROUP BY
StateProvince
ORDER BY
StateProvince DESC
然后我的结果是
2
1
10
1
1
我认为group by正在返回一个字符串?无论哪种方式,我如何得到结果
10
2
1
1
1
答案 0 :(得分:0)
这纠正了我的问题。
SELECT Count (StateProvince) AS "Count"
FROM CUSTOMER
JOIN INVOICE
ON CustomerID = FK_CustomerID
GROUP BY StateProvince
ORDER BY Count DESC