Mysql Delete Error Code 1064
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 error 1064 (42000): you have an error in your sql syntax; 1 DELETE FROM images AS i WHERE i.image_id = 805 AND i.plant_num = 1064 mysql 2277 LIMIT 1 but i am getting the error: 1064: You have an error in your SQL syntax; check mysql error 1064 (42000) the manual that corresponds to your MySQL server 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' you have an error in your sql syntax check the manual that corresponds to your mysql server version at line 1 any idea what is causing this because everything looks okay to me. Thanks in advance mysql 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
#1064 - You Have An Error In Your Sql Syntax;
Discussion Starter ray_broome 8 Years Ago thanks, i tried doin that but still get the same 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 = 227
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
Check The Manual That Corresponds To Your Mysql Server Version For The Right Syntax To Use Near
Us Learn more about Stack Overflow the company Business Learn more about hiring developers mysql server version for the right syntax to use near '' at line 1 or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack error 1064 mysql 42000 mysqldump Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Can SELECT but can't DELETE up vote https://www.daniweb.com/programming/databases/threads/123020/mysql-error-1064-when-deleteing 0 down vote favorite I'm having difficulty deleting the desired rows from my table in MySQL. I'm using a rather complex subquery to select the rows, but for some reason I'm unable to delete them using a similar syntax. delete * from table1 as t1 where t1.col1 in (select y.col1 from table2 x join (select col1, col2 from table2 where col2 like "%- 2%") y on http://stackoverflow.com/questions/7114313/can-select-but-cant-delete x.col2 = replace(y.col2, "- 2", "")); Again, I can select the exact rows I wanted deleted, but when I change the query to delete I get the following error: 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... Any help is greatly appreciated. mysql join subquery sql-delete share|improve this question edited Aug 11 '15 at 13:05 Brian Tompsett - 汤莱恩 3,091132775 asked Aug 18 '11 at 21:22 leadingzero 17118 add a comment| 4 Answers 4 active oldest votes up vote 2 down vote accepted Remove the * after DELETE. You don't usually delete individual columns, you delete entire rows. share|improve this answer answered Aug 18 '11 at 21:24 yan 15.5k12345 wow. so much time spent on such a dumb mistake. thanks all! –leadingzero Aug 18 '11 at 21:32 add a comment| up vote 2 down vote yep, you should use delete from table1 or if there are more than one table in the query, you need to enter the name of the table you want to delete from. delete table1 from table1 inner join table2 on table1.
DOMAINS WEB DESIGN WEB DESIGN SERVICES CREATE YOUR OWN WEBSITE SITE HOSTING TOOLS MEET http://www.inmotionhosting.com/support/website/database-troubleshooting/error-1064 US MEET US ABOUT US PARTNERS & AWARDS BLOG WE'RE HIRING CONTACT US AMP LOGIN SUPPORT CENTER Search Support Center Product Guides http://dev.mysql.com/doc/en/error-messages-server.html Dedicated Hosting Reseller Hosting KnowledgeBase Website Email Domain Names Reseller Billing Community Support Browse Questions Ask a Question User Submitted Articles Education error 1064 Channels Android BoldGrid cPanel DokuWiki Drupal 7 Drupal 8 Everything Email Joomla 2.5 Joomla 3.1 K2 Magento 1.6 Mambo MediaWiki Moodle Movable Type OpenCart OpenCart 2.0 osCommerce PHP-Fusion PHP-Nuke phpBB phpList Premium Website Builder PrestaShop 1.5 PrestaShop 1.6 SMF Tiki Wiki VirtueMart 3 Web Hosting you have an Manager Website Design WordPress Tools & Resources Email Configuration Blacklist Check Visual DNS Lookup Quick Tagger Icon Sets Favicon Generator Bounce Back Parser What is my IP address? >>Website .htaccess (17)Adobe Flash (2)APIs (2)Backup and Restore (15)Billing (8)Browser Issues (2)Connecting to a Database (5)cPanel (26)cPanel Account Management (16)Cron Jobs (4)Cube Cart (2)Database Setup (5)Database Troubleshooting (6)Domain Management (2)Dreamweaver (12)Drush (2)eCommerce (7)Elasticsearch (4)Fantastico (4)File Management (16)File Manager (6)FTP (10)FTP Client Setup (21)General Server Setup / Management (15)Getting Started Guides (18)Ghost (3)Google Tools (21)How To (23)HTML (2)Image Editing (2)IP Addresses (3)iWeb (1)JavaScript (2)Joomla (10)Joomla 2.5 (36)Koken (11)Linux (27)Logaholic (5)Magento (2)Maintaining Your Website (1)Managing Files (7)Microsoft FrontPage (11)Microsoft Publisher (1)ModSecurity (7) MODx (3)New Customers (7)Open Classifieds (1)PCI Compliance (7)PHP (15)PHP Configuration (7)PHP Troubleshooting (6)phpBB (25)phpMyAdmin (10)Premium Website Builder (22)Prestashop (1)Protecting Files (5)Publishing Your S
Connectors More MySQL.com Downloads Developer Zone Section Menu: Documentation Home MySQL 5.7 Reference Manual Preface and Legal Notices General Information Installing and Upgrading MySQL Using MySQL as a Document Store Tutorial MySQL Programs MySQL Server Administration Security Backup and Recovery Optimization Language Structure Globalization Data Types Functions and Operators SQL Statement Syntax The InnoDB Storage Engine Alternative Storage Engines High Availability and Scalability Replication MySQL Cluster NDB 7.5 Partitioning Stored Programs and Views INFORMATION_SCHEMA Tables MySQL Performance Schema MySQL sys Schema Connectors and APIs Extending MySQL MySQL Enterprise Edition MySQL Workbench MySQL 5.7 Frequently Asked Questions Errors, Error Codes, and Common Problems Sources of Error Information Types of Error Values Server Error Codes and Messages Client Error Codes and Messages Problems and Common Errors How to Determine What Is Causing a Problem Common Errors When Using MySQL Programs Access denied Can't connect to [local] MySQL server Lost connection to MySQL server Client does not support authentication protocol Password Fails When Entered Interactively Host 'host_name' is blocked Too many connections Out of memory MySQL server has gone away Packet Too Large Communication Errors and Aborted Connections The table is full Can't create/write to file Commands out of sync Ignoring user Table 'tbl_name' doesn't exist Can't initialize character set File Not Found and Similar Errors Table-Corruption Issues Administration-Related Issues Problems with File Permissions How to Reset the Root Password What to Do If MySQL Keeps Crashing How MySQL Handles a Full Disk Where MySQL Stores Temporary Files How to Protect or Change the MySQL Unix Socket File Time Zone Problems Query-Related Issues Case Sensitivity in String Searches Problems Using DATE Columns Problems with NULL Values Problems with Column Aliases Rollback Failure for Nontransactional Tables Deleting Rows from Related Tables Solving Problems with No Matching Rows Problems with Floating-Point Values Optimizer-Related Issues Table Definition-Related Issues Problems with ALT