0

我正在尝试查找在 Grails4 [GORM] 中批准了所有工作流的记录。Oracle 查询如下

select  a.test_id from
(SELECT test_id, COUNT( DISTINCT WORKFLOW_TYPE_ID ) total_count FROM   
 tr_test
WHERE  WORKFLOW_TYPE_ID IN ( 61, 62, 63 ) GROUP BY test_id ) a,
(SELECT test_id, COUNT( DISTINCT WORKFLOW_TYPE_ID ) approved_count FROM tr_test
WHERE  WORKFLOW_TYPE_ID IN ( 61, 62, 63 ) AND WORKFLOW_STATUS_ID = 2
GROUP BY test_id) b
where a.total_count = b.approved_count
and a.test_id = b.test_id;

知道如何在 HQL 中编写这个相关查询吗?

4

0 回答 0