MYSQL 1064 TRANSACTION INSERT多个表

时间:2015-02-24 22:00:11

标签: mysql insert transactions

尝试将新记录插入2个表

我得到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 'INSERT INTO work_donework_idaccepted_species_iddate_collecteddat' at line 2

BEGIN
INSERT INTO `work_done`(`work_id`, `accepted_species_id`, `date_collected`, `date_submitted`, `agency_id`, `county_id`, `state_id`, `collection_site_name`, `collection_site_code`, `permit_required`, `permit_id`, `landowner_id`, `datum`, `zone`, `easting`, `northing`, `latitude`, `longitude`, `elevation`, `received_at_dbg`, `received_from`, `date_received`, `received_by`, `passed_on_to`, `date_passed_on`, `comments`, `insufficient_information`, `date_data_input`, `data_input_by`, `frequency`, `site_information`, `submitted_by`, `specific_locality`, `gps_point`)
VALUES ('','17911','2014-06-14','2015-02-24','10','11','6','Main Site number 6','NULL','no','NULL','NULL','NAD83','NULL','NULL','NULL','39-33.005','105-06.122','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','Rick Levy','NULL','NULL','NULL','NULL','NULL')
INSERT INTO `restoration_work`(`work_id`,`patch_radius`, `patch_size`, `number_individuals`, `percent_vegetative`, `percent_flowering`, `percent_fruiting`, `species_notes`, `habitat_notes`, `comments`, `photo_number`) 
VALUES ('LAST_INSERT_ID()','NA','180 ft','>40','20','70','10','just beginning to fruit','disturbed, soil along service road mowed','on west side road. widest distribution at north end.','P1060985-88')
COMMIT

1 个答案:

答案 0 :(得分:0)

您使用的是哪种语言/工具/客户?

如果是mysql命令行工具,则需要“;”在每一行的末尾。

如果是PHP,则需要单独发布每个。

(auto_increment是红鲱鱼。)