Mysql Error 1064 Delete
Contents |
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 Business Learn more about hiring developers or posting ads with us Stack error 1064 (42000): you have an error in your sql syntax; Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack
1064 Mysql
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 mysql error 1064 (42000) can't DELETE up vote 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. you have an error in your sql syntax check the manual that corresponds to your mysql server version 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 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
#1064 - You Have An Error In Your Sql Syntax;
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.id = table2.t1ID share|improve this answer answered Aug 18 '11 at 21:28 Hudson Pena Magalhaes 762 add a comment| up vote 1 down vote Drop the *. A DELETE is an all or nothing kind of action. share|improve this answer answered Aug 18 '11 at 21:25 Joe 47.4k1084115 add a comment| up vote 1 down vote Try DELETE FROM instead of DELETE * FROM which is not valid. share|improve this answer answered Aug 18 '11 at 21:26 Bruce 1,2821014 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a
here for a quick overview of the site Help Center Detailed answers to any questions you might have check the manual that corresponds to your mysql server version for the right syntax to use near Meta Discuss the workings and policies of this site About Us mysql server version for the right syntax to use near '' at line 1 Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads
Error 1064 Mysql 42000 Mysqldump
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 6.2 million programmers, http://stackoverflow.com/questions/7114313/can-select-but-cant-delete just like you, helping 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, http://stackoverflow.com/questions/17722782/mysql-syntax-error-1064-with-on-delete-cascade firstname VARCHAR(30) NOT NULL, lastname 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,07431846 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 D
log in tour help Tour Start 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 Business http://dba.stackexchange.com/questions/76531/unable-to-delete-a-record-in-mysql Learn more about hiring developers or posting ads with us Database Administrators Questions Tags Users Badges Unanswered Ask Question _ Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their http://www.linuxquestions.org/questions/programming-9/mysql-the-syntax-to-select-doesn't-work-for-delete-542035/ database skills and learn from others in the community. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise error 1064 to the top Unable to delete a record in Mysql up vote 1 down vote favorite Let's say I have table name Company with two columns cname, location. In the table I am having two records with cname |location Asmetric |Dallas Sophore |Washington on this table when I perform a delete operation delete company where cname='Sophore'; I am getting an error Error 1064:You have an error in sql syntax check the manual that corresponds to your sql you have an server version whereas i had expected the complete record to be deleted , is the syntax wrong or it's incomplete.Any suggestions welcome mysql delete share|improve this question edited Sep 15 '14 at 7:23 asked Sep 15 '14 at 7:18 user285oo6 1178 add a comment| 1 Answer 1 active oldest votes up vote 5 down vote accepted Your error output is strange, it should be: 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 'where cname='Sophore'' at line 1 Which tell you exactly where the error is- you forgot the FROM clause on DELETE: DELETE FROM company WHERE cname='Sophore'; share|improve this answer edited Sep 15 '14 at 8:40 answered Sep 15 '14 at 7:43 jynus 7,73011123 is this FROM clause version specific(i.e. from 11g onwards) and as far as I know FROM clause is not used to select a single record(correct me if wrong) –user285oo6 Sep 15 '14 at 8:46 Emmm. MySQL != Oracle. –jynus Sep 15 '14 at 8:50 I do not know what software you talking about, but DELETE FROM is the SQL standard: sqlzoo.net/sql92.html#delete%20statement:%20searched –jynus Sep 15 '14 at 9:01 @jynus, FROM is optional in DELETE statement in Oracle and SQl-Server. (v14.12 is, well, I have no i
HCL Search Reviews Search ISOs Go to Page... LinuxQuestions.org > Forums > Non-*NIX Forums > Programming MySQL the syntax to SELECT doesn't work for DELETE User Name Remember Me? Password Programming This forum is for all programming questions. The question does not have to be directly related to Linux and any language is fair game. Notices Welcome to LinuxQuestions.org, a friendly and active Linux Community. You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today! Note that registered members see fewer ads, and ContentLink is completely disabled once you log in. Are you new to LinuxQuestions.org? Visit the following links: Site Howto | Site FAQ | Sitemap | Register Now If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here. Having a problem logging in? Please visit this page to clear all LQ-related cookies. Introduction to Linux - A Hands on Guide This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter. For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own. Click Here to receive this Complete Guide absolutely free. Search this Thread 03-30-2007, 06:29 PM #1 Melsync Member Registered: Sep 2005 Posts: 75 Rep: MySQL the syntax to SELECT doesn't work for DELETE Hi, I get to select the rows I need