如何找到用户的联合朋友

时间:2016-10-17 06:24:30

标签: orientdb

我有一个有朋友的用户:

User {
    "@rid:": "#11:2"
    ...
    friends: ["#61:1", "#61:2", "#61:3"]
}
...


User {
    "@rid:": "#11:3"
    ...
    friends: ["#61:2", "#61:3","#61:4"]
}

如何使用osql找到用户的共同朋友("#11:2","#11:3")?

因此查询应返回"#61:2", "#61:3"

1 个答案:

答案 0 :(得分:2)

试试这个:

select from User where @rid in (select out() from User where @rid = "#11:2") and @rid in (select out() from User where @rid = "#11:3")

希望有所帮助

此致