gpt4 book ai didi

mysql - 依靠 SQL

转载 作者:行者123 更新时间:2023-12-01 00:45:09 25 4
gpt4 key购买 nike

当我运行这个查询时,我该怎么做才能做到这一点。

SELECT distinct cus_areacode AS "Area Code", cus_code AS "Number"
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615;

而不是显示以下内容。

Area Code   Number
713 10015
713 10018
615 10019
615 10017
713 10011
615 10010
615 10016
615 10012
615 10014
615 10013

它可能会显示这个。

 Area Code  Number
615 7
713 3

我试过了

SELECT distinct cus_areacode AS "Area Code", count(cus_code) AS "Number"
FROM CUSTOMER
WHERE cus_areacode = 713 OR cus_areacode = 615;

但它不起作用。

最佳答案

SELECT cus_areacode AS "Area Code", count(cus_code) AS "Number"
FROM CUSTOMER GROUP BY cus_areacode

关于mysql - 依靠 SQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23166312/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com