select a.职工甲,b.姓名,a.职工乙,c.姓名
from table1 a, table2 b, table2 c
where a.职工甲 = b.代码 and a.职工乙 = c.代码

解决方案 »

  1.   

    select 姓名 from table2 where 代码 in
    (select 职工甲 from table1) or 代码 in
     (select 职工乙 from table1)
      

  2.   

    select a.职工甲,b.姓名,a.职工乙,c.姓名
    from table1 a, table2 b, table2 c
    where a.职工甲 = b.代码 and a.职工乙 = c.代码
    ---------------------------
    似乎应该把and改为or
      

  3.   

    楼主,你这个数据库是不是有问啊要!第一个数据库最好改成这样table1:
    姓名   代码
    职工甲    1   
    职工乙   2
      

  4.   

    select b.姓名 from table1 as a, table2 as b
       where a.代码=b.代码
      

  5.   

    Select T2.代码 , T2.姓名 
      from table1 T1,
           table2 T2
     where T1.职工甲 = T2.代码
        or T1.职工乙 = T2.代码;
      

  6.   

    老大,你的标怎么是这样的呀?
    谁丫色和这么不合范式的表呀?Select T2.代码 , T2.姓名 
      from table1 T1,
           table2 T2
     where T1.职工甲 = T2.代码
        or T1.职工乙 = T2.代码;
      

  7.   

    骗分!!!!!!!!!!1
    Select T2.代码 , T2.姓名 
      from table1 T1,
           table2 T2
     where T1.职工甲 = T2.代码
        or T1.职工乙 = T2.代码;