select id identity(1,1),t.* from
(select a.ent_name,b.id as b_id,b.c_id as c_id b.product_name 
 from a,b
 where a.id=b.c_id)t

解决方案 »

  1.   

    改正
    select id identity(1,1),t.* into c
    from
    (select a.ent_name,b.id as b_id,b.c_id as c_id b.product_name 
     from a,b
     where a.id=b.c_id)t
      

  2.   

    首先创建C表,然后用批量插入法将A\B中的数据插入C表中
      

  3.   

    select identity(1,1) as id , a.ent_name ,b.id as bid ,b.c_id,b.product_name 
    into c
    from a , b
    where b.c_id = a.id
      

  4.   

    不好意思,再改正哦
    select identity(int,1,1) as id,t.* into c
    from
    (select a.ent_name,b.id as b_id,b.c_id as c_id b.product_name 
     from a,b
     where a.id=b.c_id)t
      

  5.   

    select a.id,a.ent_name ,b.id ,b.c_id,b.product_name
    from A a left join B b on a.id=b.c_id