SELECT w.DangerousSourceCode as '业务号',
a.DepName as '一级单位',
b.DepName as '二级单位',
c.DepName as '三级单位',
w.WorkingInstruction as '工序岗位',
w.WorkingName as '作业名称',
w.DangerousSourceName as '危险源名称',
(case when w.ActiveType = 0 then '非活动' else '活动' end) as '活动状态',
w.LeadConsequences as '导致后果',
w.CramerPoints_L as 'L',
w.CramerPoints_E as 'E',
w.CramerPoints_C as 'C',
w.CramerPoints_D as 'D',
wdsl.DSLName as '风险等级',
w.LeadConsequences as '现有控制措施描述' ----《这里》
from WS_DangerousSource w
inner join WS_DangerousSourceLevel wdsl on w.DSLCode=wdsl.DSLCode
left join department a on a.depcode = (case when len(w.depcode)<=2 then left(w.depcode,2) else '' end)
left join department b on b.depcode = (case when (len(w.depcode) >2 and len(w.depcode) <=5 ) then left(w.depcode,5) else '' end)
left join department c on c.depcode = (case when (len(w.depcode) >5 and len(w.depcode) <=8 ) then left(w.depcode,8) else '' end)写了这样一句SQL,在“现有控制措施描述”中有好多个字段组成!我不知道怎么合起来,然后用"/"隔开!
等待高手指教!
等待高手指教!多字段合並用"+"號,有數字時需要轉換為字符如: select rtrim(數字型字段)+'/'+字符字段..
'现有控制措施描述'
_______________________
DPCScript/TMPScript/TMScript/PARScript/RRCScript/LLPScript/EDPScript/OIScript*********/*********/********/*********/*********/*********/*********/********
* 代表每个字段中存放的数据!
上面英文都是库里的各个字段名称,他们都属于,w 就是我上面的表对象名!
现在如何把这些数据组合起来,显示到我GridView上去!