gpt4 book ai didi

mysql - 东方数据库 : Only show results/return something if a min of datasets is available

转载 作者:行者123 更新时间:2023-11-29 02:17:46 25 4
gpt4 key购买 nike

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

user->user_has_profiles->profile 该查询将返回例如配置文件。

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

我只想在至少有 5 个用户参与我的查询时返回结果。

我为 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 (
...

最佳答案

我试过这些记录。

enter image description here

这是图表。

enter image description here

我使用了这个查询

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

enter image description here enter image description here

希望对您有所帮助。

更新

你也可以使用这个查询

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

关于mysql - 东方数据库 : Only show results/return something if a min of datasets is available,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36858423/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com