SELECT DATEDIFF(YEAR,a.Birthday,GETDATE()) Age,a.*,u.UnitType,u.UnitName,c1.CodeName SexName,c2.CodeName NativeName,c3.CodeName FolkName,
c4.CodeName ZuiGaoXueLiName,c5.CodeName SourceName,c6.CodeName yuandanweiOutlaycodeName,c7.CodeName FirstDutyCodeName,c8.CodeName PersonSortCodeName,
c9.CodeName HomeplaceName,c10.OrganName DepartmentName,c11.CodeName WeaveStateCodeName,c12.CodeName kaiserdomcodeName,c13.CodeName WeaveSortcodeName,
c14.CodeName outlaycodeName,c15.CodeName SecondDutyCodeName,c16.CodeName CadreSortName,c17.CodeName StudyCodeName,c18.CodeName WeaveSortcodeName,
FROM (
SELECT '0' Mark,* FROM A001A002
UNION ALL
SELECT '1' Mark,* FROM A021A002) a
LEFT JOIN Unit_Status u ON u.UnitID = a.UnitID
Left Join (Select Code,CodeName From Sys_Code Where CodeType='AX') c1 ON a.Sex=c1.Code
Left Join (Select Code,CodeName From Sys_Code Where CodeType='AB') c2 ON a.Native=c2.Code
Left Join (Select Code,CodeName From Sys_Code Where CodeType='AE') c3 ON a.Folk=c3.Code
Left Join (Select Code,CodeName From Sys_Code Where CodeType='PH') c4 ON a.ZuiGaoXueLi=c4.Code
Left Join (Select Code,CodeName From Sys_Code Where CodeType='YB') c5 ON a.Source=c5.Code
Left Join (Select Code,CodeName From Sys_Code Where CodeType='AOutlay') c6 ON a.yuandanweiOutlaycode=c6.Code
Left Join (Select Code,CodeName From Sys_Code Where CodeType='ADUTYOfO') c7 ON a.FirstDutyCode=c7.Code
Left Join (Select Code,CodeName From Sys_Code Where CodeType='APersonSort') c8 ON a.PersonSortCode=c8.Code
Left Join (Select Code,CodeName From Sys_Code Where CodeType='AB') c9 ON A.Homeplace=c9.Code
Left Join DepartInfo c10 ON A.DepartmentID=c10.UnitID
Left Join (Select Code,CodeName From Sys_Code Where CodeType='AWeaveState') c11 ON A.WeaveStateCode=c11.Code
Left Join (Select Code,CodeName From Sys_Code Where CodeType='AT') c12 ON A.kaiserdomcode=c12.Code
Left Join (Select Code,CodeName From Sys_Code Where CodeType='AWeave') c13 ON A.WeaveSortcode=c13.Code
Left Join (Select Code,CodeName From Sys_Code Where CodeType='AOutlay') c14 ON A.outlaycode=c14.Code
详细解决方案
咯血,求好方法。left join 多次同个表
热度:33 发布时间:2016-04-24 21:13:13.0
相关解决方案
- 关于inner join 的返回类型有关问题
- js编写的贪吃蛇,无论如何改变div的top、left,蛇和食物在地图显式位置始终不变
- poi导入excel出现 Initialisation of record 0x86 left 2 bytes remaining still to be re解决办法
4.1) eclipse集成内嵌Maven
- 初学ASP.NET, 询问个简单有关问题, LEFT , RIGHT, SUBSTRING这些函数没有吗
- 8个表的 inner join ,现在3万条数据就支持不住了, 怎么处理
- 如何绑定 left.ascx 的代码
- 一次inner join select和 多次select 哪位高手的效率高
- div.animate({left:'+=200'},2000);中的'+=200'是什么意思啊解决方案
- Linq 查询 join 失败 !该如何解决
- 绑定的SqlDataSource中能不能用Inner join?对应的Eval、Bind如何写
- 急inner join 有关问题
- 究竟怎样让两个div完全重合呢?小弟我通过把两个div的style都设置成:"position: absolute; left: 138; top: 300px; width: 236px; height: 2
- 这个语句应该如何用inner join
- 求一条SQL语句关于 INNER JOIN,该如何解决
- full join 在不同数据库有不同结果,知道的一定要近来看下(内详)解决办法
- along with 跟 inner join、left join的关系?该如何处理
- along with 和 inner join、left join的关系
- along with 跟 inner join、left join的关系?该如何解决
- 关于full join 3个表关联有关问题
- 小弟我想判断excel某一列的末尾是否为冒号,如果是就去掉,不是就保留原来数据,这个不对吗:=IF(RIGHT(G4,1)=“:”,G4,LEFT(G4,LEN(G
- 怎么用VBA设置word中图文框的top、left
- left join不能用?该怎么解决
- informix 分组统计 left join解决方法
- left join不能用?解决方案
- informix 分组统计 left join解决方案
- 多个表 inner join 的执行有关问题
- 在foxpro中可以使用update inner join 的方法关联修改一个表吗解决方法
- left outer join 中的有关问题
- JSTL 联结字符fn:join()