insert newtable select distinct tablename.fieldname from tablename这句SQL有错误吗?

解决方案 »

  1.   

    或者insert newtable(name,sex,age) select distinct tablename.fieldname from tablename这句SQL有错误吗?
      

  2.   

    前后的字段以及字段的类型要一致
    假设sex、age为Int类型insert newtable select distinct tablename.fieldname,0,0 from tablename
      

  3.   

    insert newtable select distinct * from tablename
      

  4.   

    insert into newtable select distinct tablename from tablename
      

  5.   

    insert newtable select distinct * from tablename
    这个语句的结果应该不是开始想要的,
    我希望是只按一个‘tablename.fieldname’来过滤,
      

  6.   

    对照一下把:
    INSERT INTO MyBooks
       SELECT title_id, title, type
       FROM titles
       WHERE type = 'mod_cook'
      

  7.   

    insert into newtable(FIELDNAME) select distinct TABLENAME.FIELDNAME from tablename
      

  8.   

    insert into newtable select distinct tablename.fieldname,field1,field2,... from tablename;
      

  9.   

    to:wwwwwa(aaaa)
     大哥你的QQ号码是多少?我们可以QQ上聊一下吗?我的是7464573,谢谢!!!
      

  10.   

    insert into newtable select distinct tablename.fieldname from tablename如果还有错
    建议楼主看一下数据库的结构
    有时候完全一样也可能有问题的
    比如,有个字段是标示(就是会自动加1啊什么的)
    那么在原表里是可以的
    但是你要Insert 到新表里就肯定不行了