有3个我已链接到一起的表格,其中一个字段是电缆类型,我希望通过电缆类型获得总数," bd.buss_cable"
select
r.residence_id,
bd.buss_id,
bd.buss_description,
bd.sub_system,
bd.sub_mfg,
bd.sub_drop_id,
bd.buss_address,
bd.buss_cable,
bs.Drop_id,
bs.bus_order,
bs.next_drop,
bs.distance_next_drop,
bs.subsystem_code
from Residence as r
left join buss_drops as bd on
r.residence_id = bd.Residence_residence_id
left join bus_sequience as bs on
bd.buss_id = bs.bus_buss_id
where r.residence_id = 'Andora 9661'
#order by r.residence_id, bd.buss_cable, bd.buss_id, bs.bus_order
group by bd.buss_cable
;
答案 0 :(得分:0)
如果您只需要一个计数,那么添加
-md md5
到列列表,否则添加
count(*)
到列列表。
您已经在所需的列上进行分组,因此我认为其中一个可以解决问题。
如果我误解了这个问题,请道歉。