Using SQL ABS

From: Andre Lomonaco (andrelomonac..mail.com)
Date: Sat Jul 24 2010 - 22:19:06 UTC

  • Next message: masjab: "cayenne.xml not found"

          Hi Everyone,

          I'm newbie in Cayenne and I will apreciate if someone can help me in one question..

          I have a table with a VARIACAO Field (Type DOUBLE)
          I can store in this Field Positive and Negative Numbers

          When I execute the following code, it's return to me first the Negative values and after the Positive values

          SelectQuery query = new SelectQuery(RiscoTotal.class);
          query.addOrdering(RiscoTotal.VARIACAO_PROPERTY,true);

           ObjectContext context = BaseContext.getThreadObjectContext();
           List<RiscoTotal> riscoTotal = context.performQuery(query);

           Return: -12.0, -6.0, 3.0, 15.0

           My questions is:

           How can I do to make a query to return only the ABS value
           I wanna receive the following results

           15.0, -12.0, -6.0, -3.0

           My Best Regards,

           Andre Lomonaco



    This archive was generated by hypermail 2.0.0 : Sat Jul 24 2010 - 22:19:42 UTC