Error 1064 Delete
Contents |
statements DELETE FROM images AS i WHERE i.image_id = 803 AND i.plant_num = 2277 LIMIT 1 DELETE FROM images AS i WHERE i.image_id = 804 AND i.plant_num = 2277 LIMIT 1 DELETE FROM images AS error 1064 (42000) i WHERE i.image_id = 805 AND i.plant_num = 2277 LIMIT 1 but i am error 1064 mysqldump getting the error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server mysql error 1064 version for the right syntax to use near 'AS i WHERE i.image_id = 803 AND i.plant_num = 2277 LIMIT 1; DELETE FROM images A' at line 1 any idea what is causing this because
Sql Error 1064
everything looks okay to me. Thanks in advance ray_broome 25 posts since Aug 2004 Community Member 3Contributors 10Replies 11Views 8 YearsDiscussion Span 8 Years Ago Last Post by mwasif 0 mwasif 10 8 Years Ago Write statements without aliase e.g. DELETE FROM images WHERE image_id = 803 AND plant_num = 2277 LIMIT 1; 0 Discussion Starter ray_broome 8 Years Ago thanks, i tried doin that but still get the same error 1064 sqlstate 42000 basic error. Query: DELETE FROM images WHERE image_id = 803 AND plant_num = 2277 LIMIT 1; DELETE FROM images WHERE image_id = 804 AND plant_num = 2277 LIMIT 1; DELETE FROM images WHERE image_id = 805 AND plant_num = 2277 LIMIT 1; Error: Could not update the database: 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 '; DELETE FROM images WHERE image_id = 804 AND plant_num = 2277 LIMIT 1; DELETE F' at line 1 and here's a PHP snippet: foreach($removals as $id) $sql .= "\nDELETE FROM images WHERE image_id = ".$id." AND plant_num = ".$_REQUEST['pid']." LIMIT 1;"; 0 trudge 8 8 Years Ago What does your PHP query statement print out as? I'm betting it's not what you think it is. Also, a describe images would help us help you. 0 Discussion Starter ray_broome 8 Years Ago well the query i showed you is what prints out. DELETE FROM images WHERE image_id = 803 AND plant_num = 2277 LIMIT 1; DELETE FROM images WHERE image_id = 804 AND plant_num = 2277 LIMIT 1; DELETE FROM images WHERE image_id = 805 AND plant_num = 2277 LIMIT 1; and describe i
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company error 1064 sqlstate 42000 (er_parse_error) Business Learn more about hiring developers or posting ads with us Stack Overflow Questions
Error 1064 You Have An Error In Your Sql Syntax
Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers,
Error 1064 Mysql Workbench
just like you, helping each other. Join them; it only takes a minute: Sign up What is wrong with this SQL DELETE FROM syntax? up vote 4 down vote favorite I'm trying to delete 96k records. https://www.daniweb.com/programming/databases/threads/123020/mysql-error-1064-when-deleteing delete all the records in table xoops_bb_posts_text pages that don't have a have a matching post_id to xoops_bb_posts This query worked returning 91k records: SELECT * FROM xoops_bb_posts_text t WHERE not exists ( select post_id from xoops_bb_posts p WHERE p.post_id = t.post_id ); when I tried to delete those records I got a syntax error, but I don't see it. DELETE FROM xoops_bb_posts_text t WHERE not exists ( select post_id from xoops_bb_posts p WHERE http://stackoverflow.com/questions/8403388/what-is-wrong-with-this-sql-delete-from-syntax p.post_id = t.post_id ); Where is the error? Error SQL query: Documentation DELETE FROM xoops_bb_posts_text t WHERE NOT EXISTS ( SELECT post_id FROM xoops_bb_posts p WHERE p.post_id = t.post_id ) MySQL said: Documentation #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 'WHERE not exists (select post_id from xoops_bb_posts p WHERE p.post_id = t.post_' at line 2 mysql sql share|improve this question edited Dec 6 '11 at 16:48 Dmitry B. 4,8131834 asked Dec 6 '11 at 16:32 BryanWheelock 4,143124777 1 Ah, my eyes! Please work on your code formatting next time. –Richard J. Ross III Dec 6 '11 at 16:47 I don't know mysql, but my guess is that the SELECT post_id in the subquery also needs an alias, since the queried table is aliased, and post_id is ambigious. (so:: "select p.post_id). Select * would also do the trick. –wildplasser Dec 6 '11 at 17:09 add a comment| 6 Answers 6 active oldest votes up vote 7 down vote accepted To me, this problem is more easily solved by using a delete statement with a an outer join and looking for the rows that had no match. Something like this: delete t from xoops_bb_posts_text as t left outer joi
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta http://stackoverflow.com/questions/17722782/mysql-syntax-error-1064-with-on-delete-cascade Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping error 1064 each other. Join them; it only takes a minute: Sign up MySQL Syntax Error #1064 with ON DELETE CASCADE up vote 0 down vote favorite For the life of me, I cannot find out why MySQL doesn't like this statement: CREATE TABLE IF NOT EXISTS personnel ( id INTEGER AUTO_INCREMENT PRIMARY KEY, firstname VARCHAR(30) NOT NULL, lastname sql error 1064 VARCHAR(30) NOT NULL, role VARCHAR(50) NOT NULL, line_manager INTEGER NULL, FOREIGN KEY (role) REFERENCES roles(name) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (line_manager) REFERENCES personnel(id) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB; The resulting output from MySQL after inserting this is ERROR 1064 (42000): 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 'DELETE CASCADE UPDATE CASCADE, FOREIGN KEY (line_manager) REFERENCES personnel(id) ' at line 10. Can anyone suggest what I'm doing wrong? mysql syntax-error share|improve this question edited Jul 18 '13 at 12:07 asked Jul 18 '13 at 11:55 CJxD 1,07431745 the error you pasted is unrelated to the ddl; you have a missing ON keyword before UPDATE CASCADE in a constraint definition just before another one that references the staff table –ᴳᵁᴵᴰᴼ Jul 18 '13 at 12:02 Ah, sorry, I partially lied. I changed the DDL from staff to personnel to avoid further confusion. The error h