date | nums | tag |
2019-3-11 | 1 | A |
2019-3-11 | 2 | B |
2019-3-12 | 4 | A |
2019-3-12 | 5 | B |
select nu-nums,F.tag
from
(
select *
from
pandora_fea_num
where
{t [conditions.daterange1(first)]}
) F INNER JOIN
(
select nums as nu, t as nt, tag
from
pandora_fea_num
where
{t [conditions.daterange1(last)]}
) M where F.tag=M.tag
分母为0的处理情况:
select
F.
date
as
date
, (
case
M.nums=0
then
0
else
100*(F.S/M.nums)
end
)
as
pvr, M.L
as
source
from
(
select
date
, nums, source
as
L
from
img_monitor_imageid
where
date="20190806"
) M
INNER
JOIN
(
select
date
, nums
as
S ,source
as
D
from
img__fea
where
date="20190806"
) F
where
F.
date
=M.
date
and
F.D=M.L;