【发布时间】:2022-08-05 23:48:10
【问题描述】:
我要写一个有子查询的案例,如下所示,但我既不能输出也不能出错:
select
case
when f.resGeo.isRural = true
then (select g.ID as geo_id
from bktsample.scpPC.GeoInfo g
where g.PROVINCE_ID = f.resGeo.province.id
and g.CITYES_ID = f.resGeo.countie.id
and g.PART_ID = f.resGeo.part.id
and g.CITYORCOUNTRY_ID = f.resGeo.countie.id
and g.VILLAGE_ID = f.resGeo.village.id)
when f.resGeo.isRural = false
then (select g.ID
from bktsample.scpPC.GeoInfo g
where g.PROVINCE_ID = f.resGeo.province.id
and g.CITYES_ID = f.resGeo.countie.id
and g.PART_ID = f.resGeo.part.id
and g.CITYORCOUNTRY_ID = f.resGeo.countie.id)
end as geo_id
from bktsample.scpPC.Family f;
PS:GEO 是我的收藏,scpPC 是我的范围,bktsample 是我的桶。
-
我对“既没有输出也没有错误”感到困惑。当您执行此查询时,一定发生了一些事情。是不是超时了?您创建了哪些索引?
-
我没有得到任何输出,就像输出:[]
-
我看到:查询返回 0 个结果
标签: subquery case couchbase n1ql