INSERT INTO classm_t_class_people_link (userid,classid) values( 63201654876799020,0)  where not exists (select ctcpl.id from classm_t_class_people_link ctcpl where ctcpl.userid=63201654876799020 and classid=0)上面的SQL哪儿错啦啊?

解决方案 »

  1.   

    mysql 没这个写法
    INSERT INTO `tb` (`Id`,`Name`) 
    SELECT 1,'ccc'
    FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `tb` WHERE `Id`=1  LIMIT 1);
      

  2.   

    错误提示是什么? MYSQL中所谓的编译报错没听说过啊。
      

  3.   

    SQL错误(1064):You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'where 1' at line 2
      

  4.   


    但是只写这个就没有错误啊  INSERT INTO classm_t_class_people_link (userid,classid) VALUES(63201654876799020,0)
      

  5.   

    系统提示非常清楚,where附近语法错误。MYSQL中没有这种 insert into (...) values (...) where 的语法。