问题描述
在图中,我想知道分别具有Coastal ='Y'和Coastal ='N'的州的数量,并且当我分别使用子查询时,可以获得正确的结果。但是,当我输入两个查询时,它们突然多个“ Y”和“ N”。我不知道他们为什么给我奇怪的结果。
%%sql
Select count(numcoastal)
From (Select state,count(*) as numcoastal
From Regions Where coastal ='Y' Group by state)C
count(numcoastal)
19
%%sql
Select count(numnot)
From (Select state,count(*) as numnot
From Regions Where coastal ='N' Group by state)NC
count(numnot)
24
%%sql
Select count(numcoastal),count(numnot)
From (Select state,count(*) as numcoastal
From Regions Where coastal ='Y' Group by state)C,(Select state,count(*) as numnot
From Regions Where coastal ='N' Group by state)NC
count(numcoastal) count(numnot)
456 456
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)