orientDB:仅显示结果/ return 如果有最少的数据集可用

orientDB : Only show results / return something if a min of datasets is available

我构建了一个查询生成器来生成子查询,我可以在子查询上访问与用户相关的特定数据,但不直接包含用户信息。

user->user_has_profiles->profile 该查询将 return 例如个人资料。

由于一个用户可以拥有多个配置文件,因此此查询的结果数量可能是 amount_of_users * 0-n

如果至少有 5 个用户参与我的查询,我只想 return 结果。

我为 sqlite / mysql SQL syntax: select only if more than X results 找到了这个,但是因为 join 和 having 都不能用于 orientDB 我很想知道是否有任何解决方案。

查询的示例部分

 select expand(rid) from (
   select person_id, last(rid) as rid from (
     select in('person_owns_profile').person_id[0] as person_id, @rid as rid, valid_from from (
       select from (
         ...

我试过这些记录。

这是图表。

我使用了这个查询

select from (select from profile)
let $b= (select count(*) from user)
where $b[0].count>5

希望对您有所帮助。

更新

您也可以使用此查询

select from (select from profile) where "true" in (select if(eval(" count > 2"), "true", "false") from (select count(*) from user))