版本:2.0.12
表1查询sql和截图
select
*
from
table1
where
pt between '20241205'
and '20241205'
and ed_code = '0224416'
and order_id = 2221432
and publish_flag = 1;
表二查询sql和截图
select
*
from
table2
where
pt between '20241205'
and '20241205'
and ed_code = '0224416';
两个表left join分组求和,结果为null,不符合预期,结果应该为37
select
sdd.pt,
sdd.ed_code,
sum(psd.play_cnt) as play_cnt
from
table1 sdd
left join table2 psd
on sdd.ed_code = psd.ed_code
and sdd.pt = psd.pt
and sdd.order_id = psd.order_id
where
sdd.pt between '20241205'
and '20241205'
and sdd.order_id = 2221432
and sdd.publish_flag = 1
and sdd.ed_code = '0224416'
group by
sdd.pt,
sdd.ed_code