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 ?...

问题:

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 ?


回答1:

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


回答2:

HQL supports LIKE, so you can express this as:

SELECT *
FROM Customer e
WHERE e.mobile LIKE '%999999999';
  • 发表于 2019-03-08 03:22
  • 阅读 ( 146 )
  • 分类:sof

条评论

请先 登录 后评论
不写代码的码农
小编

篇文章

作家榜 »

  1. 小编 文章
返回顶部
部分文章转自于网络,若有侵权请联系我们删除