有个sql,怎么处理就对了,如下:
select e from table_b where (a,b) in (select distinct a,b,c from table_a)
这么写总是报错,too many values,这个错误是在oracle中报的,希望更正后最好也能在sybase里使用
求指导!!!!!!先谢谢啦!!!!!!!sqlinoraclesybase
select e from table_b where (a,b) in (select distinct a,b,c from table_a)
这么写总是报错,too many values,这个错误是在oracle中报的,希望更正后最好也能在sybase里使用
求指导!!!!!!先谢谢啦!!!!!!!sqlinoraclesybase
oracle 可以这样用呀!
(a,b) in (select distinct a,b)
选择table_b表的e字段,条件是table_b表的a,b字段在table_a表的distinct a,b,c里面
条件是a,b,c三个字段去重的结果集
选择table_b表的e字段,条件是table_b表的a,b字段在table_a表的distinct a,b,c里面,这里的distinct a,b,c不能写为distinct a,b,要不distinct的结果集就不一样了
distinct a ,b,c 与distinct a,b都包含a,b 就成了吧
你只要比a,b在就行了是么?
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的结果就是一条