-1

如何仅查询人员经理列表?我尝试使用 Distinct 无济于事。这是我的数据的快照:我有人员 GNumber(如 ID)和人员的 managerGNumber,这应该可以实现。谢谢你。

First    Last        Gnumber     Department            ManagerGNumber   Title
Alex     Anderson    G000001     Corp                                   CEO
Brooke   Brown       G000002     Accounting            G000001          VP
Carol    Clark       G000003     Marketing             G000001          VP
David    Drew        G000004     Human Resources       G000001          VP
Walter   Watson      G000005     Finance               G000001          VP
Erin     Eisley      G000006     Tables                G000002          Director
Felicia  Ford        G000007     Accounting            G000002          Director
Grace    Griffin     G000008     IT                    G000003          Director
Henry    Howard      G000009     Sales                 G000003          Director
Ian      Iverson     G000010     Product Development   G000004          Director
Janice   Jones       G000011     Operations            G000004          Sr. Architect
Xenon    Xandruski   G000012     Sales                 G000005          Director
Karl     King        G000013     Human Resources       G000006          Sales Rep
Mike     Miller      G000014     Sales                 G000007          Sales Rep
Linda    Lewis       G000015     Accounting            G000006          Sales Rep
Nancy    Nash        G000016     Sales                 G000007          Sales Rep
4

1 回答 1

0

如果你的底层数据库是基于 SQL 的,如果你能以某种方式做到这一点,那么它只会产生 ManagerGnumber 列中没有代表的人:

select * 
from yourTable 
where Gnumber in (
    select distinct(ManagerGnumber) 
    from yourTable
);
于 2013-10-10T21:07:24.083 回答