最后,我们使用本机查询解决了:
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();
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)