大神来帮忙把sql转换成hql 30
SQL:selectrole0_.role_idasrole1_10_1_,role0_.role_pidasrole2_10_1_,role0_.role_nameas...
SQL:
select role0_.role_id as role1_10_1_, role0_.role_pid as role2_10_1_, role0_.role_name as role3_10_1_, role0_.role_isparent as role4_10_1_, privileges1_.role_id as role2_10_3_, privilege2_.privilege_id as privilege1_3_, privilege2_.privilege_id as privilege1_8_0_, privilege2_.privilege_pid as privilege2_8_0_, privilege2_.privilege_name as privilege3_8_0_, privilege2_.privilege_icon as privilege4_8_0_, privilege2_.privilege_url as privilege5_8_0_, privilege2_.privilege_target as privilege6_8_0_, privilege2_.privilege_isparent as privilege7_8_0_, privilege2_.privilege_type as privilege8_8_0_ from dc_member_role role0_ left outer join dc_member_role_privileges privileges1_ on role0_.role_id=privileges1_.role_id left outer join dc_member_privilege privilege2_ on privileges1_.privilege_id=privilege2_.privilege_id order by privileges1_.privilege_id 展开
select role0_.role_id as role1_10_1_, role0_.role_pid as role2_10_1_, role0_.role_name as role3_10_1_, role0_.role_isparent as role4_10_1_, privileges1_.role_id as role2_10_3_, privilege2_.privilege_id as privilege1_3_, privilege2_.privilege_id as privilege1_8_0_, privilege2_.privilege_pid as privilege2_8_0_, privilege2_.privilege_name as privilege3_8_0_, privilege2_.privilege_icon as privilege4_8_0_, privilege2_.privilege_url as privilege5_8_0_, privilege2_.privilege_target as privilege6_8_0_, privilege2_.privilege_isparent as privilege7_8_0_, privilege2_.privilege_type as privilege8_8_0_ from dc_member_role role0_ left outer join dc_member_role_privileges privileges1_ on role0_.role_id=privileges1_.role_id left outer join dc_member_privilege privilege2_ on privileges1_.privilege_id=privilege2_.privilege_id order by privileges1_.privilege_id 展开
2015-02-12
展开全部
给你提点建议,你这个查询不用那么麻烦的,sql不是有group by吗,用那个即可
SELECT merchant_area as name,count(*) as num
FROM merchant
GROUP BY merchant_area
改成HQL为
SELECT m.merchantArea AS name,COUNT(m.ID) AS num FROM Merchant AS m GROUP BY m.merchantArea!
SELECT merchant_area as name,count(*) as num
FROM merchant
GROUP BY merchant_area
改成HQL为
SELECT m.merchantArea AS name,COUNT(m.ID) AS num FROM Merchant AS m GROUP BY m.merchantArea!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询