基本上我有一堆属于经销商的汽车,经销商有一个小组。经销商表具有 GROUP.ID,组表具有组名。一个集团有多个经销商
所以我想计算每组有多少辆车。
我正在使用这个自动取款机
select
(select GROUP_NAME from "GROUP" where "GROUP".GROUP_ID = "DEALER"."GROUP_ID" ),
"DEALER"."GROUP_ID" as "DEALER GROUP ID",
"DEALER"."DEALER_NAME" as "DEALER DEALER NAME",
"CAR"."CAR_DEALER" as "CAR DEALER"
from
"CAR"
INNER JOIN
DEALER
ON
"DEALER"."DEALER_NAME" ="CAR"."CAR_DEALER"
我试过使用group_by
,count
但我似乎无法让它工作