Hi, Yes current SQL parser can't do math computation, the only way to do it is using the eval().
Lvc@ On 6 August 2014 05:40, M B <[email protected]> wrote: > So I got this to work with a different query using eval(). > > Is this the right way to do this? > > > String > query = "select key, received as previous, $temp[0].current as current, > $temp[0].delta as delta from Activity, let $temp = (select received as > current, eval('received - $parent.current.received') as delta from Activity > where ($parent.current.key = key) and (time > $parent.current.time) order > by time limit 1)"; > And the output: > > > #-2:1{key:wsbroker1,previous:100,current:120,delta:20} v0 > > #-2:2{key:wsbroker1,previous:120,current:130,delta:10} v0 > > #-2:3{key:wsbroker1,previous:130,current:150,delta:20} v0 > > #-2:4{key:wsbroker1,previous:150,current:190,delta:40} v0 > > #-2:5{key:wsbroker1,previous:190} v0 > > > -- > > --- > 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 [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- --- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
