sql语句---查询结果作为表与其他表进行条件查询 5
SELECT*FROM(SELECTDISTINCTREGISTERID,TOTALMONEY,RECIPESTATE,OPERATETIME,RECIPETYPE,DI...
SELECT *
FROM (SELECT DISTINCT REGISTERID,TOTALMONEY,RECIPESTATE,OPERATETIME,RECIPETYPE,DIAGNOSEID,REGISTEROFFICEID,DOCTORID,RECIPECONTENT,EXECOFFICEID,
RECIPESTATE,APPLYDOCNO FROM CLINICPHYSICIANRECIPE) A
left join T_PATIENT_INFO B on A.DIAGNOSEID=B.DIAGNOSEID
left join T_OFFICE C on A.REGISTEROFFICEID=C.OFFICEID
left join T_USERS D on A.DOCTORID=D.USERID
left join CLINICBRIEFEMR E on A.DIAGNOSEID=E.DIAGNOSEID and a.REGISTERID=E.REGISTERID
left join S_MEDORD_MAIN F on A.RECIPECONTENT=F.MEDORDID
left join T_OFFICE G on A.EXECOFFICEID=G.OFFICEID
left join C_SUBCATEGORY CS on F.SUBCATEGORY=CS.ID
left join C_CHECKLISTS CC on A.APPLYDOCNO=CC.CHECKLISTNO
WHERE A.RECIPETYPE='检查' AND A.RECIPESTATE=0 AND A.OPERATETIME>=CURRENT DATE - 15 DAYS
本人是小白,想咨询下大神,我的的语句是不是写的有问题?需要怎么写才能完成上述查询?
尝试将将(SELECT DISTINCT REGISTERID,TOTALMONEY,RECIPESTATE,OPERATETIME,RECIPETYPE,DIAGNOSEID,REGISTEROFFICEID,DOCTORID,RECIPECONTENT,EXECOFFICEID,
RECIPESTATE,APPLYDOCNO FROM CLINICPHYSICIANRECIPE) A,换成表的话,该语句无问题。但单独表无法满足小白需求
求大神指点。。。。 展开
FROM (SELECT DISTINCT REGISTERID,TOTALMONEY,RECIPESTATE,OPERATETIME,RECIPETYPE,DIAGNOSEID,REGISTEROFFICEID,DOCTORID,RECIPECONTENT,EXECOFFICEID,
RECIPESTATE,APPLYDOCNO FROM CLINICPHYSICIANRECIPE) A
left join T_PATIENT_INFO B on A.DIAGNOSEID=B.DIAGNOSEID
left join T_OFFICE C on A.REGISTEROFFICEID=C.OFFICEID
left join T_USERS D on A.DOCTORID=D.USERID
left join CLINICBRIEFEMR E on A.DIAGNOSEID=E.DIAGNOSEID and a.REGISTERID=E.REGISTERID
left join S_MEDORD_MAIN F on A.RECIPECONTENT=F.MEDORDID
left join T_OFFICE G on A.EXECOFFICEID=G.OFFICEID
left join C_SUBCATEGORY CS on F.SUBCATEGORY=CS.ID
left join C_CHECKLISTS CC on A.APPLYDOCNO=CC.CHECKLISTNO
WHERE A.RECIPETYPE='检查' AND A.RECIPESTATE=0 AND A.OPERATETIME>=CURRENT DATE - 15 DAYS
本人是小白,想咨询下大神,我的的语句是不是写的有问题?需要怎么写才能完成上述查询?
尝试将将(SELECT DISTINCT REGISTERID,TOTALMONEY,RECIPESTATE,OPERATETIME,RECIPETYPE,DIAGNOSEID,REGISTEROFFICEID,DOCTORID,RECIPECONTENT,EXECOFFICEID,
RECIPESTATE,APPLYDOCNO FROM CLINICPHYSICIANRECIPE) A,换成表的话,该语句无问题。但单独表无法满足小白需求
求大神指点。。。。 展开
TableDI
2024-07-18 广告
2024-07-18 广告
仅需3步!不写公式自动完成Excel vlookup表格匹配!Excel在线免,vlookup工具,点击54步自动完成表格匹配,无需手写公式,免费使用!...
点击进入详情页
本回答由TableDI提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询