实现类
String sql = "SELECT a.`GRADE_NAME` GRADE_NAME,b.`SUBJECT_NAME` SUBJECT_NAME,SUM(`FRACTION`) sum_fraction,AVG(FRACTION) avg_fraction " +
"FROM `achievement` c " +
"LEFT JOIN `grade` a ON a.`ID` IN (SELECT d.`GRADE_ID` FROM `student` d WHERE d.`ID`=c.`SCHOOL_NUMBER_ID`) " +
"LEFT JOIN `subject` b ON b.`ID` = c.`SUBJECT_ID` GROUP BY a.`GRADE_NAME`,b.`SUBJECT_NAME`";
Query query = null;
List<Map> list = null;
query = session.createSQLQuery(sql);
list = query.list();
return list;