0

可能重复:
sql语句怎么写?

IncidentReportid                  Interviewers                 MainInterviewer 
18 :Name/nric/Desg/iunit/remark: NAME2/inric/iDesg/iunit/iremark:                nric
19 :irank/inric/iDesg/iunit/iremark:irank1/inric1/iDesg1/iunit1/iremark1:        inric  
20 :irank4/inric4/iDesg4/iunit4/iremark4:irank5/inric5/iDesg5/iunit5/iremark5:   inric5
21 :irank7/inric7/iDesg7/iunit7/iremark7:irank8/inric8/iDesg8/iunit8/iremark8:   inric7
23 :irank9/inric9/iDesg9/iunit9/iremark9:irank6/inric6/iDesg6/iunit6/iremark6:   inric9
24 :RankOfAddison/aNRIC/aInstructor/aUnit/aRemark:RankOfNang/nNRIC/nInstructor/nUnit/nRemark:  aNRIC

例如。我有上面的表格,我想得到如下数据。谢谢。:)

IncidentReportid                Interviewers       MainInterviewer             
18                                Name             nric
19                                irank            inric                 
20                                irank5           inric5               
21                                irank7           inric7                 
23                                irank9           inric9                
24                                RankOfAddison    aNRIC  

主要是我想获得“面试官”的名字取决于主要面试官的身份证。

4

1 回答 1

0
select IncidentReportid,
       SUBSTRING(Interviewers,2,CHARINDEX('/',Interviewers)-2) as Interviewers,
       MainInterviewer
from Table
于 2012-07-25T04:03:30.877 回答