我尝试根据技能代码匹配Hold_Target
的值,但无论我做什么,它总是以NULL
返回。我在查询中做错了吗?这是我正在使用的。
Select
ei.TM,
ei.emp_id,
ei.DNAME,
ei.STATUS,
ei.SHIFT,
ei.SKILL,
ct.Target as Hold_Target
From
mtl_extended_info ei
Left outer join (
Select
ct.Skill,
ct.Target as Target
From
cdl_threshold ct
Where
ct.Metric LIKE CONVERT(_utf8 '%Avg Hold Time%' USING latin1) COLLATE latin1_swedish_ci
) ct on ct.SKILL = ei.SKILL
Where
ei.Visible = 1
Group by
ei.emp_id
Order By
ei.SM,
ei.TM,
ei.DNAME
cdl_threshold table
Skill Metric Target
WR Avg Hold Time 100
CA Avg Hold Time 100
预期结果
TM emp_id DNAME STATUS SHIFT SKILL Hold_Target
Peter Parker 842448 Joe Doe A FT CA 100