子查询一定要注意,别忘记加TOP 1,不然就GG了,过了好久测试给我测出来了
Posted 我把所有的财富都放进博客里了,想要就进来拿吧
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了子查询一定要注意,别忘记加TOP 1,不然就GG了,过了好久测试给我测出来了相关的知识,希望对你有一定的参考价值。
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了,过了好久测试给我测出来了的主要内容,如果未能解决你的问题,请参考以下文章