gpt4 book ai didi

我的查询的 mysql 查询错误

转载 作者:行者123 更新时间:2023-11-29 14:37:40 25 4
gpt4 key购买 nike

我收到此错误:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VALUES (1039,200,'2',NULL,NULL,NULL,'cash',NULL,1)' at line 1

对于此查询:

INSERT INTO anu_donations (projectid,donation_amount,donated_by,donated_by_uid,donation_details, comments,payment_medium,donor_comments,created_by)

VALUES (1039,100,'1',NULL,NULL,NULL,'cash',NULL,1), VALUES (1039,200,'2',NULL,NULL,NULL,'cash',NULL,1);

enter image description here

最佳答案

您只需VALUES一次

INSERT INTO anu_donations    
(projectid,donation_amount,donated_by,donated_by_uid,donation_details,
comments,payment_medium,donor_comments,created_by)

VALUES
(1039,100,'1',NULL,NULL,NULL,'cash',NULL,1),
(1039,200,'2',NULL,NULL,NULL,'cash',NULL,1);

参见INSERT in the MySQL docs :

INSERT statements that use VALUES syntax can insert multiple rows. To do this, include multiple lists of column values, each enclosed within parentheses and separated by commas. Example:

INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);

关于我的查询的 mysql 查询错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8666443/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com