表1  a    b   c
 x^y   45  45
 a^b   89  56表2 a1   b1  c1
 x    y   88
 a    b   56把表2的:a1^a2 连接起来。插进表1的a列,并检查a1^a2在表1中是否存在,如果存在就不用插入了。这条语句应该怎样写?

解决方案 »

  1.   

    把表2的:a1^b1 连接起来。插进表1的a列, 
      

  2.   

    insert tb1(a)select a1+b1 from tb2 
      

  3.   

    把表2的:a1^b1 连接起来。插进表1的a列, 
      

  4.   


    --?
    insert into 表1(a)
    select a1+'^'+b1 from 表2
    where a1+'^'+b1 not in(select a from 表1)
      

  5.   

    insert tb1  select a1+b1,b1+c1,c1 from tb2  where tb1.a!=a1+b1  这样行不行
      

  6.   

    a1+'^'+b1 这样加起来有错
    String or binary data would be truncated.
    The statement has been terminated.
      

  7.   

    insert into 表1
    select a1+'^'+b1 from 表2
    where a1+'^'+b1 not in(select a from 表1)问个问题哦,表2一共三列,两列合并成一列插入到表一里面,那表一岂不是要空一列
      

  8.   

    a1+'^'+b1  这样加起来会有空格: x    ^y
      

  9.   


    rtrim(ltrim(a1))+'^'+rtrim(ltrim(b1))