Can HQL Select on the result set of another query?

前端 未结 4 986
情话喂你
情话喂你 2020-12-10 11:15

Can HQL Select on the result set of another query?
For example:

SELECT COUNT(*) FROM (SELECT * FROM Table)


I can do it in SQL but w

4条回答
  •  情深已故
    2020-12-10 11:42

    Using subquery as you desire is not possible. One way is using a distinct this way:

    SELECT COUNT(DISTINCT t.id) FROM table t INNER JOIN t.list l
         WHERE t.status = 'ST1' AND l.status = 'ST2'"
    

    I used the inner join to express a select repetition

提交回复
热议问题