如何编写子查询? [英] How do I write a sub-query?
本文介绍了如何编写子查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想检索所有顶点,并希望为每个顶点计算指向它的赞"边数.
I want to retrieve all vertexes and for each one I want to count the number of 'Like' edges pointing at it.
如何在Gremlin中编写这种查询?
How do I write this kind of query in Gremlin?
在SQL中可能类似于......
In SQL it could be something like....
SELECT *, (SELECT Count(*) FROM tbl_like l WHERE l.id = b.id) AS LikeCount
FROM tbl_blah b
推荐答案
不需要副作用...
g.V().transform{[it, it.in('likes').count()]}
这篇关于如何编写子查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文