SQL Server case when 日期字符串转换 多表查询 嵌套子查询

SQL Server case when 日期字符串转换 多表查询 嵌套子查询,第1张

概述select distinct stu.*,dbo.GetClassNameByStudentCode(stu.Code) as ClassName,dbo.GetCourseNameByStuden
select distinct stu.*,
dbo.GetClassnameByStudentCode(stu.Code) as Classname,dbo.GetCoursenameByStudentCode(stu.Code) Coursename,dbo.GetlinkmanByStudentID(stu.ID) linkman,dbo.GetContactByStudentID(stu.ID) Contact,
case when svr.linkman is not NulL then svr.linkman else dbo.GetlinkmanByStudentID(stu.ID) end Visitlinkman,when svr.Contact then svr.Contact else dbo.GetContactByStudentID(stu.ID) VisitContact,1)">when u1.Sname NulL and u1.Sname<>'' then u1.Sname else u1.Username VisitFollowUsername,1)">CONVERT(CHAR(10),svr.FollowTime,23) VisitLastFollowTime,
scl.name as SchoolAreaname,
svr.ContentMemo as VisitContentMemo,
dict1.name as StudentStatusname
from FM_Student stu left join FM_StudentClass sc on stu.Code=sc.Codejoin FM_Class cls on cls.ClassCodesc.ClassCode join FM_Course cou on cou.IDcls.CourseID join FM_CourseSubject cs on cs.IDcou.CourseSubjectIDjoin FM_StudentContact cc on cc.StudentIDstu.IDjoin FM_SchoolArea scl on scl.IDstu.SchoolAreaIDjoin FM_StudentVisitRecord svr on svr.ID(top 1 svr1.ID FM_Student stu1join FM_StudentVisitRecord svr1 on stu1.Code=svr1.Code and stu1.ID=stu.ID order by svr1.ID desc)join Sys_User u1 on u1.IDsvr.FollowUserIDjoin Sys_Dict dict1 on dict1.Type='{1}' and dict1.Codestu.StudentStatuswhere stu.DelFlg<>{0}

 

*,scl.name  SchoolAreaname,dbo.GetClassnameByStudentCode(stu.Code)  VisitContentMemo,dict1.name  StudentStatusname,((select sum(pf.PayAmount)  FM_PayFlow pfjoin FM_Student stu1 on pf.CustomerCode=stu1.Code and stu1.Code=stu.Code) -((psf.PayAmount)  FM_PayStepFlow psf join FM_PayFlow pf1 on psf.PayFlowIDpf1.IDon pf1.CustomerCode=stu.Code))  as ArrearageAmount --欠费金额0} and (sc.Status{2}or sc.Status is NulL         and            ((pf.PayAmount)          FM_PayFlow pf        >        ((psf.PayAmount)          FM_PayStepFlow psf         pf1.ID        =stu.Code)

 

总结

以上是内存溢出为你收集整理的SQL Server case when 日期字符串转换 多表查询 嵌套子查询全部内容,希望文章能够帮你解决SQL Server case when 日期字符串转换 多表查询 嵌套子查询所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1153018.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存