美文网首页
SQL联合查询语言

SQL联合查询语言

作者: Will_板凳 | 来源:发表于2020-03-12 20:29 被阅读0次

    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')))
    

    相关文章

      网友评论

          本文标题:SQL联合查询语言

          本文链接:https://www.haomeiwen.com/subject/awbwjhtx.html