0
我執行下面的sql代碼,我想獲得「parent.name,child.name」,但返回的列表的值是「parent.name,parent.name」?誰能幫忙?數據庫是MySQL的休眠選擇值覆蓋
String sql = "select parent.name,child.name from CATEGORY as parent,CATEGORY as child where child.CATEGORY_ID=7 and child.SUB_TYPE in (80,81) and child.PARENT_ID=parent.ID;";
Query query = session.createSQLQuery(sql);
return query.list();
期望的結果:
parent.name child.name
a d
b e
c f
當前結果:
parent.name child.name
a a
b b
c c
順便說一句,我可以通過執行SQL獲得SQLyog的客戶端正確的結果。
你如何遍歷結果? – 2013-05-06 09:41:29