from子句中的JPA子查询

from子句中的JPA子查询,第1张

from子句中的JPA子查询

最后,我们使用本机查询解决了:

 String query = "SELECt ROUND(subquery.numberf*100/" + features + ",0) AS "matches", m.id_model AS "id_model",  m.name AS "name", m.brand AS "brand", m.url_pict AS "url_picture""     + " FROM (select count(*) AS numberf, id_model AS idModel FROM model_features WHERe value LIKE '%Yes%' "     + "AND id_feature IN(" + idFeatures + ") GROUP BY id_model) subquery, Models m WHERe subquery.numberf > 0 "     + "AND subquery.idModel = m.id_model ORDER BY subquery.numberf DESC, m.name";return em.createNativeQuery(query).getResultList();


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5587863.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-14
下一篇 2022-12-14

发表评论

登录后才能评论

评论列表(0条)

保存