Search code examples
sqljpaselecthql

How to do arithmetic operations in expression?


We are tying to write a hql query. It is not recognizing + operator in SELECT clause.

X WHERE LL2 >=(SELECT XX+56 FROM SSK WHERE B='L') 

I want to add XX with 56. Is it possible?

It is giving an error saying that XX 56 doesnt make sense. Specifically it is not recognizing + in between them.


Solution

  • You don't need to add 56 to select query.

    Just use minus 56 from LL2. If you are passing LL2 value to the query you can do it before passing it.

     WHERE (LL2-56) >=(SELECT XX FROM SSK WHERE B='L')