日期:2014-05-18  浏览次数:20510 次

求救优化SQL
SELECT   tRegPatient.PatientID,tRegPatient.LocalName,tRegPatient.EnglishName,tRegPatient.Birthday,tRegPatient.Telephone,tRegPatient.ReferenceNo,tRegPatient.Address,tRegVisit.InhospitalNo,tRegVisit.ClinicNo,tRegVisit.CurrentAge,
                                                tRegVisit.BedNo,tRegOrder.AccNo,tRegProcedure.ExamSystem,tRegProcedure.Modality,tRegProcedure.Charge,tRegProcedure.Status   as   RPStatus,
                                                (SELECT   LocalName   from   tUser   where   tUser.UserGuid=tRegProcedure.Registrar)   as   Registrar,
                                                (SELECT   LocalName   from   tUser   where   tUser.UserGuid=tRegProcedure.Technician)   as   Technician,
                                                (SELECT   LocalName   from   tUser   where   tUser.UserGuid=tRegProcedure.TechDoctor)   as   TechDoctor,
                                                (SELECT   LocalName   from   tUser   where   tUser.UserGuid=tRegProcedure.TechNurse)   as   TechNurse,
                                                (SELECT   Description   from   tDictionaryValue   where   tDictionaryValue.DictionaryValue=tRegPatient.Gender   and   tDictionaryValue.Tag=1)   as   Gender,
                                                (SELECT   Description   from   tDictionaryValue   where   tDictionaryValue.DictionaryValue=tRegProcedure.Status   and   tDictionaryValue.Tag=13)   as   Status,
                                                (SELECT   Description   from   tDictionaryValue   where   tDictionaryValue.DictionaryValue=tRegOrder.ApplyDept   and   tDictionaryValue.Tag=2)   as   ApplyDept,
                                                (SELECT   Description   from   tDictionaryValue   where   tDictionaryValue.DictionaryValue=tRegOrder.ApplyDoctor   and   tDictionaryValue.Tag=8)   as   ApplyDoctor,
                                                (SELECT   Description   from   tDictionaryValue   where   tDictionaryValue.DictionaryValue=tRegVisit.PatientType   and   tDictionaryValue.Tag=5)   as   PatientType,
    &nb