SQL 联合查询
SELECT patient.uid, patient.`patientid`,course.`coursename`, site.`name` FROM tmspatient patient, tmscourse course , tmssite site WHERE patient.`uid` = course.patientuid AND course.`uid` = site.`courseuid`
ef查询
var queryDgSessions = (from dgs in _dbWrapper._RT_TMSEntities.tmsdeliverybeamgroup_session
join dg in _dbWrapper._RT_TMSEntities.tmsdeliverybeamgroups on dgs.deliverybeamgroupuid equals dg.uid
join t in _dbWrapper._RT_TMSEntities.tmstreatmentsessions on dgs.treatmentsessionuid equals t.uid
select new
{
BeamGroupUid = dg.uid,
TreatmentsessionUid =dgs.treatmentsessionuid,
TreatmentSession = new DM_Cal_Session{
UID = t.uid,
IsScheduled = t.isscheduled,
StartDate = t.plandate,
StepUid =t.stepuid,
TimeStamp = t.updatetime,
},
} );
select where in用法
SELECT * FROM student WHERE uid IN (
SELECT studentuid FROM course WHERE uid IN (
SELECT courseuid FROM teacher WHERE uid IN('11111111')))
网友评论