@nagaraja sosale ramaswamy, I'm trying to understand how this query works. Specifically, I can't see how "in" and "out" are defined. I built a quick sample database using this script, but when I run the query (either yours or Andrey's), I get a syntax error saying "invalid script". I'm using the BROWSE tab of OrientDB Studio, version 2.2.8. Has something changed in the language since this was posted, or am I missing something? I found the link to this topic in the OrientDB 2.2.x documentation <http://orientdb.com/docs/2.2.x/Query-Examples.html>.
Initial setup: insert into V (name) values ('V1'),('V2') create edge E from (select from V where name = 'V1') to (select from V where name = 'V2') set count = 17 create edge E from (select from V where name = 'V2') to (select from V where name = 'V1') set count = 3 Test query (you will have to substitute "#17:0" for the actual key in your DB): select v.name, sum(count) as cnt from (select if(eval("in=#17:0"),out,in) as v,count from E where (in=#17:0 or out=#17:0)) order by cnt desc group by v On Friday, June 5, 2015 at 5:26:30 AM UTC-5, nagaraja sosale ramaswamy wrote: > Andrey, > > you are very welcome. i'll be adding this to the Query Examples wiki page > if you don't mind. > > > ~nagu. > > On Friday, June 5, 2015 at 12:30:12 AM UTC+5:30, Andrey Yesyev wrote: >> >> This is the final version of the query I need >> >> select v.name, sum(count) as cnt from (select if(eval("in=#17:0"),out,in) >> as v,count from E where (in=#17:0 or out=#17:0)) order by cnt desc group >> by v >> >> Nagu, I greatly appreciate your help and time you spent on this! >> > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to orient-database+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.