tryselect c.*,a.* 
from 病人表 a
inner join 病人病历表 b on a.病人ID=b.病人ID
inner join 医生表 c on b.医生ID=c.医生ID
inner join 医院表 d on c.医院ID=d.医院ID

解决方案 »

  1.   

    由于这几个表能通过两两的id形成传递,所以就可以通过inner join来取出交集~
      

  2.   

    在 SQL中可以!!不知道你熟悉java不!!我们的表已经持久化成对象了!!HQL语句是这样!报错 StringBuffer sqlBuffer=new StringBuffer("select a" +
    " from DPatientInfo a left join " +
    " DPatientCaseInfo b where a.nid = b.patient.nid left join " +
    " DDoctorInfo c where b.doctor.nid = c.nid left join " +
    " DHospitalInfo d where c.hospital.nid = 34");
      

  3.   

    java还是初学者,不熟哦!但好像应该改成这样,你看看.
    select a.*" +
    " from DPatientInfo a left join " +
    " DPatientCaseInfo b on a.nid = b.patient.nid left join " +
    " DDoctorInfo c on b.doctor.nid = c.nid left join " +
    " DHospitalInfo d on c.医院ID=d.医院ID where c.hospital.nid = 34楼主java很厉害吧,能交流交流不? 呵呵!
      

  4.   

    left join 后不能用where关键字关联,要用on关键字关联