日期:2014-05-17  浏览次数:20416 次

关于一个HQL语句 急急急………………
from InvestmentScheduleD isd inner join fetch isd.investmentScheduleH ish inner join ish.investmentPlanH iph inner join iph.investmentPlanD ipd where isd.PlanStepID = ipd.PlanStepID and iph.InvestmentPlanStatus =1 and  ish.InvestmentScheduleHStatus=1 

  此语句关系到的有四张表InvestmentScheduleD   investmentScheduleH    investmentPlanH   investmentPlanD

  请问写成sql应该怎么写  
------解决方案--------------------
from
 InvestmentScheduleD isd 
inner join
 investmentScheduleH ish 
on
 isd.PlanStepID = ish.PlanStepID 
inner join
 investmentPlanH iph 
on
 isd.PlanStepID = iph.PlanStepID
inner join
 investmentPlanD ipd 
on
 isd.PlanStepID = ipd.PlanStepID
where
 iph.InvestmentPlanStatus =1 and ish.InvestmentScheduleHStatus=1  

------解决方案--------------------
select *  
from InvestmentScheduleD ,investmentScheduleH ,investmentPlanH ,investmentPlanD
where ...--这里把关系加上即可.