码迷,mamicode.com
首页 > 其他好文 > 详细

子查询一定要注意,别忘记加TOP 1,不然就GG了,过了好久测试给我测出来了

时间:2017-12-08 12:07:21      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:sele   ted   pre   gui   parent   uid   ati   ring   string   

            string sql = "select Code,DepartmentName"
                    + ",(select  top 1   OrgName from SysBest_Organization where TreeId = CompanyId ) as CompanyId"
                    + ",(select  top 1   OrgName from SysBest_Organization where TreeId = ParentDepartmentId ) as ParentDepartmentId"
                    + ",(select  top 1   OrgName from SysBest_Organization where TreeId = AdjustedParentCompanyId ) as AdjustedParentCompanyId"
                    + ",(select  top 1   OrgName from SysBest_Organization where TreeId = AdjustedParentDepartmentId ) as AdjustedParentDepartmentId"
                    + ", AdjustedCode,AdjustedDepartmentName,AdjustedDate,Regulator,VGUID from X6_Organization_DepartmentAdjust ";

子查询一定要注意,别忘记加TOP 1,不然就GG了,过了好久测试给我测出来了

标签:sele   ted   pre   gui   parent   uid   ati   ring   string   

原文地址:http://www.cnblogs.com/tangpeng97/p/8004393.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!