Select A.ts_id AS num,
A.ts_title AS title,
B.[name] + '【 ' + IsNull(B.part, ' ') + ' 】' AS [name],
C.[name] AS operator,
D.ts_name as comment,
bldType =
CASE A.ts_bld_Type
WHEN 0 THEN 'Y'
ELSE 'N'
END,
earType =
CASE A.ts_ear_type
WHEN 0 THEN 'Y'
ELSE 'N'
END,
plsqlNo =
CASE A.ts_plsql_no
WHEN null THEN ''
ELSE E.ts_name
END,
From usr_deploy as A
INNER JOIN tbl_tmUser as B ON A.ts_user_id = B.id
INNER JOIN tbl_tmUser as C ON A.ts_operator = C.id
INNER JOIN ts_selections as D ON A.ts_execution_comment = D.ts_id
LEFT OUTER JOIN ts_selections as E ON A.ts_plsql_no = E.ts_id
Where A.ts_id = 4731