我需要查询几条数据,
查询出来之后再插入这个表,   表A
id,num,class,melody
比如查询出A表5条数据。
然后再把这5条数据插入A表,主键唯一,
    insert into A select * from A where num=1,
    insert into A values (num,class,melody) where  exists (select * from A where num= 1) 
                       这2条都不行。附:如果能把num改为2插入更好。

解决方案 »

  1.   

    查询出A表5条数据。
    然后再把这5条数据插入A表为什么你不插入到B表。本来A表已经有数据了。
      

  2.   

    insert into A(num,class,melody) select num=2,class,melody from A where num=1--or
    insert into A(num,class,melody) select num=num+1,class,melody from A where num=1
      

  3.   

    其实我是想把NUM改为2再插入A表,  但是现在先要能做到把那5条数据插入自己表,
    到时候根据ID,Update一下就行了。
      

  4.   

    不知道是否符合你的要求,先export到临时文件,然后import进表。export to temp.del of del select * from from A where num=1;import form temp.del of del insert_update into A;
      

  5.   

    楼主基本语法都不对哦,插入应该写成
    insert into tablename (column A,B,...etc)values (value A,B,...etc)
    再试试吧,祝你成功哦~