求JAVA大侠指点迷津
String hql ="select distinct c.good_price,t.good_price,t.good_num,t.good_name,t.good_unit from (select a.good_price,a.good_num,b.good_name,b.good_unit from InstorageDetail as a,GoodInfo as b where a.good_id=b.id and a.operate_time between ? and ? and a.hotel_id=? and b.hotel_id=?) t,OutstorageDetail as c where t.good_id=c.good_id";(select a.good_price,a.good_num,b.good_name,b.good_unit from InstorageDetail as a,GoodInfo as b where a.good_id=b.id and a.operate_time between ? and ? and a.hotel_id=? and b.hotel_id=?)这样查出来是6条数据,期望也是6条数据
但是OutstorageDetail 中和 t表对应的记录为,每样对应3条,结果就是笛卡尔积,一共18条结果了,求高手指点这个HQL语句怎样写,我期望去掉OutstorageDetail 中重复数据,最后得到6条数据 --------------------编程问答-------------------- 用join关联查询。where的形式得到的就是笛卡尔积 --------------------编程问答-------------------- 恩,谢谢高手指点,我菜鸟,能帮我写下用join关联查询的HQL语句吗? --------------------编程问答--------------------
哥们,你可以问技术点,不过这类问题不要期望有人帮你写,也没人会帮你写的.人家表都没有,你这么一大串发出来谁愿意看,你说呢?
补充:Java , Java相关