Help for query with max()

43 views
Skip to first unread message

Krasimir Cholakov

unread,
Feb 8, 2015, 11:42:06 AM2/8/15
to orient-...@googlegroups.com
Hello, 

supposing there is a graph like this one:

Post (id = #14:30)
|
|----comment-----> Comment (version = 1)
|----comment-----> Comment (version = 2)
|----comment-----> Comment (version = 3)

What will be the query to select only the Comment with the latest version for Post with id #14:30?

I need something like: 

select * from (
  select expand(out[relation='comment'].in) from #14:30
)
where version = ? ( is the latest i.e. 3 in this case )

Thank you in advance.


Krasimir Cholakov

unread,
Feb 9, 2015, 6:42:51 AM2/9/15
to orient-...@googlegroups.com
Anyone? Let me put it this way. Why is this not working:

select * from (
  select expand(out[relation='comment'].in) from #14:30
)
where version = (select max(version) from Comment)

What is the correct syntax?

Thanks again.

Academia Learning Centro de inglés y de formación

unread,
Nov 25, 2016, 8:08:28 AM11/25/16
to OrientDB
Anyone?
Reply all
Reply to author
Forward
0 new messages