联表时 o1对多个o2时 去重 相加o1 count
SELECT sum(DISTINCT case when o1.id then o1.count else 0 end ) as a1Count
from o1_tb as o1 left join o2_tb as a2 on o1.id = o2.o1_id
联表时 o1对多个o2时 去重 相加o1 count
SELECT sum(DISTINCT case when o1.id then o1.count else 0 end ) as a1Count
from o1_tb as o1 left join o2_tb as a2 on o1.id = o2.o1_id