Basicly I have a bunch of Cars that belong to dealers and the dealers have a group. The dealer table has the GROUP.ID and the Group table has the group name. A Group has multiple dealers
因此,我想估计每个群体有多少辆汽车。
我正在利用这个机会。
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
,但我看不出工作。