qq_34706893
qq_34706893
2016-04-18 10:34

求把sql写成hql语句!!

  • hql
  • hibernate

select r.studentno,r.studentname,r.total from (
select t.studentno,t.studentname,count(1) total from tb_studented t,tb_course c,student_course s
where t.id = s.student_id and c.id = s.course_id group by t.studentno,t.studentname
) r where r.total = (select max(total) from (select s.student_id,count(1) total from student_course s group by s.student_id))
StringBuilder sql =new StringBuilder();

hibernate 在工程中我建了Student.java 和Course.java 配置好映射,中间的连接表叫student_course , 这个是写的查找选课最多的学生的信息,求大神写成HQL 语句

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

0条回答