select 
...
from main_table m, tc_contrast_type a, tc_contrast_type b, tc_contrast_type c
where m.test_item=a.type_code
  and m.function_type=b.type_code
  and m.error_type=c.type_code 
;

解决方案 »

  1.   

    SELECT b.test_id, a.type_name as test_item, c.type_name as function_type, d.type_name error_type,e.type_name status
    FROM tc_contrast_type a INNER JOIN
        maintest b ON a.type_code = b.item INNER JOIN
        tc_contrast_type c ON b.function_type = c.type_code INNER JOIN
        tc_contrast_type d ON b.error_type = d.type_code INNER JOIN
        tc_contrast_type e ON b.status = e.type_code
      

  2.   

    14:26:19 jlanzpa817>select TEST_ID,a.type_name,b.type_name,c.type_name,d.type_name
    14:27:28   2  from test5,tc_contrast_type a,tc_contrast_type b,
    14:27:28   3       tc_contrast_type c,tc_contrast_type d
    14:27:28   4  where TEST_ITEM = a.type_code and FUNCTION_TYPE = b.type_code and
    14:27:28   5     ERROR_TYPE = c.type_code and STATUS = d.type_code
    14:27:28   6  ;TEST_ID              TYPE_NAME  TYPE_NAME  TYPE_NAME  TYPE_NAME
    -------------------- ---------- ---------- ---------- ----------
    2002091109104        测试       函数       错误       状态
    200209101            测试2      测试       测试2      状态1已用时间:  00: 00: 00.10
      

  3.   

    create table test5
    (TEST_ID  varchar2(20),
     TEST_ITEM  varchar2(10),
     FUNCTION_TYPE  varchar2(10),
     ERROR_TYPE  varchar2(10),
     STATUS  varchar2(10)
    );insert into test5 values('2002091109104','74','85','65','10');
    insert into test5 values('200209101','75','40','66','11');
    commit;create table tc_contrast_type
    (type_code  varchar2(20),
     type_name  varchar2(10)
    );
    insert into tc_contrast_type values('74','测试');
    insert into tc_contrast_type values('85','函数');
    insert into tc_contrast_type values('65','错误');
    insert into tc_contrast_type values('75','测试2');
    insert into tc_contrast_type values('40','测试');
    insert into tc_contrast_type values('66','测试2');
    insert into tc_contrast_type values('10','状态');
    insert into tc_contrast_type values('11','状态1');
    commit;
    select TEST_ID,a.type_name,b.type_name,c.type_name,d.type_name
    from test5,tc_contrast_type a,tc_contrast_type b,
         tc_contrast_type c,tc_contrast_type d
    where TEST_ITEM = a.type_code and FUNCTION_TYPE = b.type_code and
       ERROR_TYPE = c.type_code and STATUS = d.type_code
      

  4.   

    谢了,我综合了一下MountLion(闷头睡)和 debut(debut)
    现在已经会写了。
    不过现一打开CSDN网页就IE报错,关闭浏览器了,所以现在不能加分了,等CSDN好了之后立马加分给大家。
    ================================================================
                       好好学习,天天向上-----骗小孩子的