表1
字段a  
varchar2        
20090801-001
表2
字段b    字段c
number  varchar2 
200908  01-001想比较 a=b+c
怎么写语句呢 

解决方案 »

  1.   

    不明白要怎么比较,但是条件可以参考WHERE条件后面:
    select * from 表1,表2 where 表1.a=表2.b||表2.c
      

  2.   

    两表中都存在的
    select *
    from 表1 inner join 表2 on a=to_char(b)||c表1中有,表2没有
    select *
    from 表1 left join 表2 on a=to_char(b)||c
    where 表2.a is null
      

  3.   

    select case when 表1.a = 表2.b||表2.c then 1 else 2 from 表1,表2 where 关联字段相等
      

  4.   

    鉴于你需要比较的字段可以转换成日期形式,就可以这样来做,从表a中去除字段1,从biao b,表C中取出字段2和字段3,用 || 连接成与字段1相符的形式(字段4),然后将字段1和字段4都转换成日期形式,在orcal中日期形式就可以做比较了。
      

  5.   


    create table table1
    (
     a varchar2(30)
    );insert into table1 select '20090801-001' from dual;
    create table table2
    (
     b number(10,0),
     c varchar2(30)
    );
      
    insert into table2 select '200908','01-001' from dual;
    select *
    from table1 a,
         table2 b
    where a.a = to_char(b.b)||b.c
      

  6.   

    select 表1.a, 表2.b||表2.c from 表1,表2 ;
      

  7.   

         比较: a和b+c
         select 表1.a, 表2.b||表2.c from 表1,表2 ;