帮我把一个sql语句改成HQL语句,谢谢!!! 50
Stringsql="selectcomName,count(casewhenpatSex='男'then1end)assumsexMen,count(casewhenp...
String sql = "select comName,count(case when patSex='男' then 1 end) as sumsexMen,count(case when patSex='女' then 1 end) as sumsexwomen from Patient group by patComName having patComName="+m+"";
展开
1个回答
展开全部
Patient为实体映射类,hql如下,望采纳,谢谢:
String hql = "select t.comName,sum(case when t.patSex='男' then 1 else 0 end) as sumsexMen,sum(case when t.patSex='女' then 1 else 0 end) as sumsexwomen from Patient t group by t.patComName having t.patComName="+m+"";
String hql = "select t.comName,sum(case when t.patSex='男' then 1 else 0 end) as sumsexMen,sum(case when t.patSex='女' then 1 else 0 end) as sumsexwomen from Patient t group by t.patComName having t.patComName="+m+"";
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询