有两个表
tableA                                            tableB
ID     title     type                             taID      myID
1000   ******    'AAA'                            1000      33333
1001   ******    'AAA'                            1001      33333
1002   ******    'AAA'                            1002      33333
1003   ******    'BBB'                            1003      44444
1004   ******    'BBB'                            1004      44444
……我要把tableA中的type为'AAA'的ID值选择出来,然后插入到tableB中的taID,tableB的myID 为某一固定值,这种批量插入该怎么写?

解决方案 »

  1.   

    insert tableb select id,'固定值' from tablea where type='aaa'
      

  2.   

    insert into tableb select id,'固定值' from tablea where type='aaa'
      

  3.   

    insert into tableB(taID,myID)
    select ID,'11111'
    from tableA
    where type = 'AAA'
      

  4.   

    insert into tableB
      select [id],'固定值' from  tableA  where type='AAA'
      

  5.   

    insert tableb select id,'固定值' from tablea where type='aaa'
      

  6.   

    insert tableb select id,'固定值' from tablea where type='AAA'
      

  7.   

    insert tableb select id,'固定值' from tablea where type='AAA'