I am working with MySQL and I am facing issues while updating the below command:
UPDATE group_access_mst SET
access='0',view='0',add='0',modify='0',delete='0',save='0',xl='0',import='0' WHERE role_id='1' AND page_id='1';
ERROR:
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 'add='0',modify='0',delete='0',save='0',xl='0',import='0' WHERE
role_id='1' AND p' at line 1
If I remove add,delete from the quesry it works fine!!
Is there any way i can make these command to work. I can understand that in MySQL ADD,DELETE,SELECT,INSERT are commands so it is not working.
In this case i need to change the fields names?
You should enclose the field names within back quote:
UPDATE group_access_mst
SET `access`='0',
`view`='0',
`add`='0',
`modify`='0',
`delete`='0',
`save`='0',
`xl`='0',
`import`='0'
WHERE role_id='1'
AND page_id='1';
Related
select b1.blog_id, blog_name, blog_desc, b1.blog_date, blog_author, blog_img, ifnull(count(blog_cmt),0) AS blog_cmt
from blog b1, user_blog b2"
I got a error in this:
Error Code: 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 '"' at line 1
Error #1064 means that MySQL can't understand your command. To fix it:
Read the error message. It tells you exactly where in your command
MySQL got confused.
Check the manual. By comparing against what MySQL
expected at that point, the problem is often obvious.
Check for reserved words. If the error occurred on an object identifier, check
that it isn't a reserved word (and, if it is, ensure that it's
properly quoted).
You need to remove the quotes at the end and run your query. Looks like there is a typo, you intended a ; instead.
select b1.blog_id, blog_name, blog_desc, b1.blog_date, blog_author, blog_img, ifnull(count(blog_cmt),0) AS blog_cmt
from blog b1, user_blog b2;
I'm trying to set a trigger in my MySQL database, so I'm using below query:
CREATE EVENT pwdupdate
ON SCHEDULE EVERY 3 MINUTE
DO
UPDATE 'passwords'
SET 'pass'= SUBSTRING((RAND())
Basically I want it to update the pass field of a table with a random string, but it keeps telling me that there's a syintax error:
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 ''passwords' SET 'pass'= SUBSTRING((RAND())' at line 5
Any help ?
EDIT : I removed the single quotes as suggested, but still the error remains
You do not need single quotes for table and column name and its invalid in mysql however you can use backticks ``
UPDATE passwords
SET pass= substring(RAND(),8)
I'm trying to search and replace in MYSQL but get an error. I'm quessing it's because of the "http://"
Anyone got any suggestions when trying replace this type of thing?
Code entered:
update movies_news set select_page = replace(select_page, ‘http://movie’, ‘http://www.movie’);
But it throws the following error:
#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 '://movie’, ‘http://www.movie’)' at line 1
Posting so it can be accepted:
update movies_news set select_page = replace(select_page, ‘http://movie’, ‘http://www.movie’);
contains smart quotes, which are not interpreted as normal single quotes, thus the syntax error. It should instead be
update movies_news set select_page = replace(select_page, 'http://movie', 'http://www.movie');
In general, be really careful about copying code to and from 'smart' text editors (Microsoft Word, etc)
I have a table newsletter and I want to delete/update/insert data in it, but when I type
delete * from crm_base.newsletter
for example, it gets an red "X" in the line and gives me the following error message:
Error Code: 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 '* from crm_base.newsletter_temp' at line 1.
I already unchecked the safe update mode in preferences and resetted workbench, but it still gives me the same error.
Can anyone help me?
delete from crm_base.newsletter
Your syntax is not correct, use DELETE FROM crm_base.newsletter WHERE condition. Check the Delete syntax reference.
I want to import an SQL file using PHPMyAdmin where I know duplicates exist. I am using the syntax:
LOAD DATA INFILE 'C:\Documents and Settings\...\db_settings_extends.sql' ignore;
I receive the error:
#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 '' at line 1
How do I correct this?
From the error message, it looks like duplicates are not the problem. It seems to not like your string value or something next to it.