select * from dbo.TS_WuLiao as wl right join ( select cgxxjl.ID,cgxxjl.GongYingShangId,cgxxjl.WuLiaoId,cgxxjl.JingJia,cgxxjl.YouXiaoRiQiK,cgxxjl.YouXiaoRiQiJ,cgxxjl.ShuiDaiMa,cgxxjl.CaiGouZu,kucun.KuCunShuLiang from dbo.TS_CaiGouXinXiJiLu as cgxxjl left join ( select WuLiaoId,SUM(ShuLiang*RorC) as KuCunShuLiang from dbo.TS_KuCun group by WuLiaoId ) as kucun on kucun.WuLiaoId = cgxxjl.WuLiaoId ) as a on a.WuLiaoId = wl.WuLiaoId
将这个查询转为hql
实在是蛋疼,hql彻底把我整崩溃了.
为啥要转hql,直接执行nactiveSql不行吗,执行以后再将结果转成你想要的对象就可以了。