我有两套a和b。我想使用条件x显示a的计数以及a(交叉点)b的计数。我使用的代码
SELECT COUNT(A) as total, COUNT(IF (condition_X)) as chg FROM A FULL OUTER JOIN B ON JOIN KEY Y
我能到达十字路口,但总的数不到a。
zdwk9cvp1#
也许你只是想要一个 cross join ?
cross join
select * from (select count(*) as cnt_a from a) a cross join (select count(*) as cnt_b from a join b on y where condition ) b
anauzrmj2#
简单的左键连接两个
Select count(A.id=B.id), count(A.id) from A left join B on A.id=B.id where condition='x'
2条答案
按热度按时间zdwk9cvp1#
也许你只是想要一个
cross join
?anauzrmj2#
简单的左键连接两个