如何在mongodb中获得union等价物?

0kjbasz6  于 2021-07-24  发布在  Java
关注(0)|答案(0)|浏览(184)

我在sql中执行了union,它使用同一个表进行组合。

select 'High school education < College education' as 'Qualification criteria',  sum(distinct a.cases) as 'Total cases'
from mydb.covid_19_info a inner join mydb.social_health_info b on a.fips = b.fips
where high_school_graduation_rate < percent_some_college
union
select 'High school education > College education' as 'Qualification criteria',  sum(distinct a.cases) as 'Total cases'
from mydb.covid_19_info a inner join mydb.social_health_info b on a.fips = b.fips
where high_school_graduation_rate > percent_some_college;

我希望使用聚合获得相同的mongodb查询。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题