大神来帮忙把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
展开
 我来答
匿名用户
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!
bvg_Winnir
2015-02-11 · TA获得超过153个赞
知道小有建树答主
回答量:288
采纳率:50%
帮助的人:255万
展开全部
闹呢`
这sql不就是hibernate自己生成的?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式