同一数据库
如何把数据表aaa的classid=100的信息全部复制到数据表bbb里?

解决方案 »

  1.   

    insert  into bbb(字段列表)
    select 字段列表
    from aaa
    where classid=100;
      

  2.   

    表bbb(id int primary key, col2 varchar(32), ....)
    字段列表指的就是id, col2 ....
    insert into bbb(id, col2) select classid, col2 from aaa where classid = 100
      

  3.   

    insert  into bbb(列1,列2.)
    select 列1,列2.
    from aaa
    where classid=100;
      

  4.   

    就是比如你想把aaa表的a b c字段导入到bbb表的d e f字段
    这样导入
    insert bbb(d,e,f)
    select a,b,c
    from aaa;注意一一对应
      

  5.   

    insert fields into tableA select fields from tableB where condition
      

  6.   

    建议楼主可以直接参考一下MYSQL的手册中的这个语法。