这是我的查询:
Query q = em.createQuery("SELECT OBJECT(historic) FROM Historic historic WHERE historic.user.id = :user_id AND historic.enchere.id = historic.enchere.id AND historic.limcoins = (SELECT MAX(historic.limcoins) FROM Historic historic WHERE historic.enchere.id = historic.enchere.id AND historic.state LIKE :state)");
q.setParameter("user_id", user_id);
q.setParameter("state", "none");
List<Historic> list = q.getResultList();
答案 0 :(得分:0)
好的,我找到了。
用IN
替换= opratorhistoric.limcoins IN (SELECT MAX(historic.limcoins) FROM Historic historic WHERE historic.enchere.id = historic.enchere.id AND historic.state LIKE :state)