mysql-error-1064

select privilege on more than one table

How do I grant select privilege on more than one table in a single statement? mysql> grant select on dbName.crw_changes to sink; Query OK, 0 rows affected (0.02 sec) mysql> grant select on dbName.crw_changes, dbName.bs_services to sink; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your ...

Error while implementing SQL Tree

Hi I'm getting the error while executing following code in MySQL : BEGIN DECLARE right_most_sibling INTEGER; SET right_most_sibling = (SELECT rgt FROM Personnel WHERE emp = 'Albert'); UPDATE Personnel SET lft = CASE WHEN lft > right_most_sibling THEN lft + 2 ELSE lft END, rgt = CASE WHEN rgt >= right_most_sibling THEN rgt + 2 ELSE rgt ...

MySQL - Using UNION with LIMIT

i noticed that (SELECT title, relavency, 'search1' as source FROM search1 ORDER BY relavency DESC LIMIT 10) UNION (SELECT title, relavency, 'search2' as source FROM search2 ORDER BY relavency DESC LIMIT 10) ORDER BY relavency DESC LIMIT 10 the last LIMIT 10 does not work. why? the error was "Error code 1064: ... to use near 'LIM...

Getting MySQL error 1064 when performing an INSERT query

What I'm doing is grabbing a feed and inserting the data from each of the feed items. Please see below for the code I'm using. Ok. So I run the page with the query, it loads the feed in to simplexml and I insert the first two items in the feed however I get an error when it gets to the third item. See below for the error I'm getting. I'...

Can any one suggest me how to resolve this problem: Error Code : 1064 in MY SQL 5.5 ver

DELIMITER $$; DROP FUNCTION IF EXISTS tonumeric $$; CREATE FUNCTION tonumeric() returns numeric BEGIN declare num numeric; set num = to_number('12'); return num; END$$ DELIMITER; $$ When I executed this function, I am facing this error. Error Code : 1064 You have an error in your SQL syntax; check the manual that correspon...

How to get the max of two values in MySQL?

I tried but failed: mysql> select max(1,0); 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 '0)' at line 1 ...

mysql syntax error

I wrote this simple query statement: INSERT INTO merchants ('firstName','lastName') VALUES ('Bob','Smith') Sounds very simple but I keep getting this 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 ''firstName','lastName' ) VALU...

MySQL transaction query help

This problem is baffling me: BEGIN; INSERT INTO sub_users(user_id, email) SELECT user_id FROM users WHERE email='[email protected]', '$email'; COMMIT; Normally, I have multiple statements in that transactions, but I've removed those for clarity. I get this error: #1064 - You have an error in your SQL syntax; check the manual that...

MySQL Stored Procedures

Hi, I'm coming from a MS SQL Server background. Working on a new project using MySQL with NaviCat 8 Admin tools. Ok, here's the question. Normally when working in MS land if I want to update some data I use a stored procedure to do this: Drop Procedure spNew Create Procedure spNew (@P_Param) UPDATE Table SET Field = 'some value' WHERE ...

What's wrong with this query?

UPDATE `t` SET `col_x` = (SELECT `col_x` FROM `t` WHERE `col_y`='123456') WHERE `col_y`= '456789' MySQL version 4.0.27 I tried few changes - with LIKE '%123456%', without backticks mysql seems to not know subquery. it's error is "You have an error in your SQL syntax ..." thanks Error message: #1064 - You have an error in your SQL...

using LIKE with logical operators

i can't seem to figure out how to combine LIKE with an OR or AND: DELETE * FROM persons WHERE FirstName = 'Abe' AND LastName LIKE '%coln'; Looks like it should owrk to me but I get error 1064 (syntax0 Is there a correct way to do this? ...

How can I change database name in mysql ?

How can I change database name in mysql ? My Database name is SPM and I want to change it to spm(small letters) I tried using RENAME DATABASE SPM TO spm; and am getting following error message: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right synt...

MySQL Trigger with Update

I'm trying to update a row when it gets updated to keep one of the columns consistant, CREATE TRIGGER user_country BEFORE UPDATE ON user_billing FOR EACH ROW BEGIN IF NEW.billing_country = OLD.billing_country AND NEW.country_id != OLD.country_id THEN SET NEW.billing_country = cms.country.country_name WHERE cms.country.country_i...

Error creating stored procedure

Hi Im trying to create this stored procedure: CREATE PROCEDURE GetExif ( IN @album VARCHAR(50), IN @pic VARCHAR(50) ) BEGIN SELECT CAMERA, FSTOP, EXPOSURE, ISO, FOCALLENGHT, DATETAKEN, GPSLATH, GPSLONG FROM EXIF WHERE ALBUMNAME = @album AND PICTURENAME = @pic END I get this error #1064 - You have an error in your SQL syn...

MYSQL - Cannot able to create table.

I am using MYSQL 5.1. When i am going create a table, it throws error like this, Query: CREATE TABLE IF NOT EXISTS payment_status ( STATUS_ID int(3) unsigned NOT NULL DEFAULT '0' , STATUS_NAME varchar(50) NOT NULL DEFAULT '' , DESC varchar(100) , PRIMARY KEY (STATUS_ID), UNIQUE KEY XPKPAYMENT_STATUS (STATUS_ID) ) Error: Er...

CREATE SCHEMA gives 1064 error

CREATE SCHEMA IF NOT EXISTS `paragraph` DEFAULT CHARACTER SET 'utf8' COLLATE default collation ; this line results with error 1064. MySql 5.4.3-beta. ...

How to MYSQL UPDATE fieldINT!=‘4’ doesn’t work

Im trying to UPDATE queueStatusINT WHERE statusINT is 8 and queueStatusINT is NOT equal to 2 and type is $type. But I keep getting an error: ERROR 1064 (42000) at line 1: 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 ‘ queueStatusINT!='2’, type=’int'...

Frustrating MySQL CREATE PROCEDURE error

Hopefully this is a nice quick one to resolve. Here is my .sql file: USE my_db; DELIMITER $$ CREATE PROCEDURE searchLocation(IN argQuery VARCHAR(32), IN argLimit INT) BEGIN SELECT DISTINCT `suburb`, `postcode` FROM `location` WHERE `suburb` LIKE '%argQuery%' OR `postcode` LIKE 'argQuery%' LIMIT argLimit ; END $$ DELIMITER ...

PHP MySQL fails whenever WHERE statement is present

I am trying to make a simple query to a small MYSQL table, but when I insert the Where clause, I suddenly get an invalid query error (added a while(mysql_fetch_array ){} when working without the where). The MYSQL console gives a 1064 (syntax) error, however, I checked the MYSQL documentation and I am using the proper syntax as far as I c...

Porting MS SQL stored procedures to MySQL

i have about 140 - 150 stored procedures that I need to migrate from MS SQL 2005 to MySQL 5.1 After succesfully porting 0 of them in the last eight hours I decied to drop by and ask if anyone has any experience, or tips, or knows some util app that can help. MySQL Administrator is not very helpfull, with a frustrating "MySQL Error numb...