日期:2014-05-20  浏览次数:20498 次

多表连接如何设主表,就是取主表的全部记录为基础。 内有语句
SELECT   benefaction.ID,   benefaction.RDno,   donation.DName,   pupil.SName,   benefaction.RAmount,   benefaction.ROdate,   benefaction.State
FROM   (benefaction   INNER   JOIN   donation   ON   benefaction.RDID   =   donation.ID)   INNER   JOIN   pupil   ON   benefaction.RSid   =   pupil.ID

想取benefaction的全部记录,现在只取了一部分..


------解决方案--------------------
SELECT benefaction.ID, benefaction.RDno, donation.DName, pupil.SName, benefaction.RAmount, benefaction.ROdate, benefaction.State
FROM benefaction
left join donation ON benefaction.RDID = donation.ID
left join pupil ON benefaction.RSid = pupil.ID