Search code examples
sqlspring-data-jpahql

CONVER RIGHT SQL TO HQL


I have a working SQL query.

But I am unable to convert the same into HQL

SELECT * FROM Customer e where RIGHT(e.mobile,10)='999999999';

How to write this into HQL ?


Solution

  • RIGHT(str, len) is the same thing as SUBSTRING(str, LENGTH(str) - len + 1)