标签: mysql hibernate distinct
我有一个表A,其中有一个表B的外键字段。 我想获取(Criteria API首选,HQL OK)X条目 A 具有唯一B引用,
有什么想法吗?
答案 0 :(得分:0)
FROM A AS a WHERE a.b IN (SELECT ax.b FROM A AS ax GROUP BY b HAVING COUNT(b) = 1)