mysql 左连接去重子表数据并汇总
SELECT sum(DISTINCT case when t1.id then t1.amount else 0 end ) as t1sumAmount
from table1 t1 left join table2 t2 on t1.id = t2.t1_id
本文只做记录
SELECT sum(DISTINCT case when t1.id then t1.amount else 0 end ) as t1sumAmount
from table1 t1 left join table2 t2 on t1.id = t2.t1_id
本文只做记录