我想使用EMP
列加入SAL
和ID
表。如果ID
表中有Sal
个重复,请将第一行与ID
sal
对应private static UITechnologyElement IterateOnControl(UITechnologyElement parent, string name)
{
UITechnologyElement te = null;
UITechnologyManager TM = Playback.GetCoreTechnologyManager("MSAA");
IEnumerator windowEnumerator = TM.GetChildren(parent, null);
windowEnumerator.Reset();
while (windowEnumerator.MoveNext())
{
UITechnologyElement current = windowEnumerator.Current as UITechnologyElement;
if (current.Name == name)
{
te = current;
break;
}
}
return te;
}
。结果应该是:
答案 0 :(得分:3)
使用窗口函数ROW_NUMBER()
SELECT SAL.ID, SAL.Gross, Sal.Net, Sal.Deductions, Emp.Name FROM EMP JOIN
(SELECT *,
ROW_NUMBER() OVER(PARTITION BY ID ORDER BY Net) rown FROM SAL
) SAL on EMP.ID = SAL.ID
WHERE SAL.rown = 1
答案 1 :(得分:0)
以下是使用row_number
窗口函数管理此方法的方法:
select * from emp e
join (select *, row_number() over(partition by id order by(select null)) rn from sal ) s
on e.id = s.id and s.rn = 1