有个sql,怎么处理就对了,如下:
select e from table_b where (a,b) in (select distinct a,b,c from table_a)
这么写总是报错,too many values,这个错误是在oracle中报的,希望更正后最好也能在sybase里使用
求指导!!!!!!先谢谢啦!!!!!!!sqlinoraclesybase

解决方案 »

  1.   

    你要匹配哪个字段?(a,b) in (select distinct a,b,c)
      

  2.   


    oracle 可以这样用呀!
    (a,b) in (select distinct a,b)
      

  3.   


    选择table_b表的e字段,条件是table_b表的a,b字段在table_a表的distinct a,b,c里面
      

  4.   


    条件是a,b,c三个字段去重的结果集
      

  5.   

    你能用自然语言描述一下你的需求逻辑吗?a,b与a,b,c的关系
      

  6.   


    选择table_b表的e字段,条件是table_b表的a,b字段在table_a表的distinct a,b,c里面,这里的distinct a,b,c不能写为distinct a,b,要不distinct的结果集就不一样了
      

  7.   

    tryexists(select 1 from tb where a=t.a and b=t.b)你是用in.
    distinct a ,b,c 与distinct a,b都包含a,b 就成了吧
    你只要比a,b在就行了是么?
      

  8.   


    distinct a ,b,c 与distinct a,b结果集不一样,例如table_a表中有两条数据a=1,b=1,c=2;a=1,b=1,c=3;
    distinct a ,b,c 的结果就是两条,而distinct a,b的结果就是一条
      

  9.   

    多个字段的话改成exists即可。
      

  10.   

    select e from table_b where exists (select distinct a,b,c from table_a where table_b .a=table_a .a and table_b .b=table_a.b)