select
100 * different / total
from
(select
count(*) as different
from
a, b
where
........) t1,
(select
count(*) as total
from
a
where
.......) t2
本文介绍了一种使用SQL进行复杂数据对比的方法,通过子查询的方式计算不同数据与总数据的比例,适用于需要进行精确数据分析的场景。
select
100 * different / total
from
(select
count(*) as different
from
a, b
where
........) t1,
(select
count(*) as total
from
a
where
.......) t2
1294
916