【发布时间】:2022-02-04 09:31:34
【问题描述】:
我有一个带有动态值的 hql 查询,看起来像这样
SELECT * from sample_view where (concat(course_id,'-',stu
_id)) in ('11-001'));
以上查询返回 4 行,但具有以下值的相同查询不返回任何内容
SELECT * from sample_view where (concat(course_id,'-',stu
_id)) in ('011-001'));
当我执行以下这些查询时,它们都返回 4 行。
SELECT * from sample_view where course_id in ('011') and stu_id in ('001');
SELECT * from sample_view where course_id in ('11') and stu_id in ('001');
当输入的数字以 0 为前缀时,如何使 concat 函数返回相同的值。在这方面的任何帮助将不胜感激。提前致谢
【问题讨论】:
标签: spring database hibernate concatenation hql