如何将表日期拆分为单独的列 [英] how to split table date into seperate columns

查看:82
本文介绍了如何将表日期拆分为单独的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得如下结果集

hi , i want to get result set as given below

Level_Inspection  Root_Visual  Final_Dpt    Type_Joint  Root_Visual  Final_Dpt  Type_Joint
Level - 02           100          10        Butt Weld    100          10       Nozzlewe        
Level - 05           100          10        Butt Weld    100          10       Nozzle Weld
Level - 03           100          20        Butt Weld    100          20       Nozzle Weld
Level - 1B           10           10        Butt Weld    10           10       Nozzle Weld
Level - 04           200          30        Butt Weld    200          30       Nozzle Weld


select L.Level_Inspection,N.Root_Visual,N.Final_Visual,T.Type_Joint
from Mst_NDT N,Mst_TypeJoint T,Mst_LevelInspection L
 where T.TypeJoint_Id=N.TypeJoint_Id and L.Level_Id=N.Level_Id ;

-- I written the above query and getting output as below

Level_Inspection  Root_Visual  Final_Dpt  Type_Joint
Level - 02	    100	          10       Butt Weld
Level - 05	    100		  10       Butt Weld
Level - 03	    100		  20       Butt Weld
Level - 1B	    100	       	  10       Butt Weld
Level - 04	    100		  10       Butt Weld
Level - 02	    100	          20       Nozzle Weld
Level - 05	    100		  20       Nozzle Weld
Level - 03	    100		  10       Nozzle Weld
Level - 1B	    10		  20       Nozzle Weld
Level - 04	    200		  10       Nozzle Weld

推荐答案

试试这个,



Try this,

select L.Level_Inspection,N.Root_Visual,N.Final_Visual,T.Type_Joint
from Mst_NDT N, Mst_LevelInspection L
cross join Mst_TypeJoint T
where T.TypeJoint_Id=N.TypeJoint_Id and L.Level_Id=N.Level_Id


这篇关于如何将表日期拆分为单独的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆