I recently upgraded to MYSQL 5. That is latest version that webhost allows. When trying to update a table or delete an entry this is the error I receive while in phpmyadmin.
Error
There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem
ERROR: Unclosed quote # 101
STR: '
SQL: DELETE FROM inmates WHERE inmates.counties_id = 33 AND CONVERT(inmates.link USING utf8) = \'http://inmate1.riversidesheriff.org/iis/\' LIMIT 1
SQL query:
DELETE FROM inmates
WHERE `inmates`.`counties_id` = 33
AND CONVERT(`inmates`.`link` USING utf8) = \'http://inmate1.riversidesheriff.org/iis/\'
LIMIT 1
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 '\'http://inmate1.riversidesheriff.org/iis/\' LIMIT
1' at line 1
and here is the query
SELECT * FROM `inmates` WHERE 1
any help is greatly appreciated
thank you.
Lose the backslash before the single-quotes: they are not required.
By that I mean, change this:
\'http://inmate1.riversidesheriff.org/iis/\'
To this:
'http://inmate1.riversidesheriff.org/iis/'
Related
There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem.
ERROR: Unclosed quote # 173
STR: "
update voucher_nos
set (select voucher_type as points from vouchers where id='1') = points+1
where company_id = '24'
and finance_year='01/01/2014-01/01/2015';
update voucher_nos
set (select voucher_type as points from vouchers where id='1') = points+1
where company_id = '24'
and finance_year='01/01/2014-01/01/2015'";
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 '(select voucher_type as points from vouchers
where id='1') = points+1 w' at line 1
helps will be appreciated
and finance_year='01/01/2014-01/01/2015'";
You have an unneccesary " at the end here, which is probably causing the Syntax error.
--
The second problem is that the first part of a SET statement should be a column name, not a value (or a query which returns one). But I'm not sure how to fix that unless you explain a bit more what you're trying to accomplish.
I go this error message when I run this query
SELECT name,state FROM customers WHERE state IN ('CA','NC','NY')
Error
SQL query: Documentation
SELECT name, state
FROM customers
WHERE state IN(
'CA', 'NC', 'NY'
)
LIMIT 0 , 30
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 '‌in ('CA','NC','NY') LIMIT 0, 30' at line 1
I has a look there http://dev.mysql.com/doc/refman/5.6/en/error-messages-server.html but I still can't find the reason why
Thank you
Remove the = after IN
SELECT name, state FROM customers
WHERE state IN ('CA','NC','NY')
SELECT name,state FROM customers WHERE state IN ('CA','NC','NY')
You can not use the '=' with an IN
I tried to copy your query and run it in MySQL
You have some strange "hidden" character before IN
If you delete it, then everything works fine
I'm having trouble figuring out why this query does not work. Names have been sanitized as this is proprietary code.
QRY:
SELECT l.albert, o.ben, m.caleb, m.dennis, m.edgar
FROM octopus o, lorax l, monkey m
WHERE o.ben = l.ben
AND l.franklin= m.franklin
AND o.ben= :ben
ORDER BY l.albert DESC
LIMIT 1
Here is the error that I get:
MySQL Error: 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 'QRY: SELECT l.albert, o.ben, m.caleb, m.dennis, m' at line 1
It seems like you have
"QRY: "
at the beginning of your query. It should start with
"SELECT ...
I tried this with MySQL:
DELETE FROM `contact_hostcommands_relation` AS `ContactHostCommand` WHERE (`ContactHostCommand`.`chr_id` = 999999) LIMIT 1
And I get this:
#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 (`ContactHostCommand`.`chr_id` = 999999) LIMIT 1' at line 1
Note: This query is automatically generated and conditions are based on table aliases.
Why I get this error?
Is there any way to use table aliases in where clause?
Is this MySQL specific?
What #Matus and #CeesTimmerman said about MSSQL, works in MySQL 5.1.73 too:
delete <alias> from <table> <alias> where <alias>.<field>...
You can use SQL like this:
DELETE FROM ContactHostCommand
USING `contact_hostcommands_relation` AS ContactHostCommand
WHERE (ContactHostCommand.`chr_id` = 999999)
LIMIT 1
You cannot use AS in a DELETE clause with MySQL :
DELETE FROM `contact_hostcommands_relation` WHERE (`chr_id` = 999999) LIMIT 1
I got this weird error after trying to execute a query on a large table:
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 '/*100,3),
'%') AS Percentage FROM
INFORMATION_SCHEMA.PROFILING WHERE
QUERY_ID=' at line 1
What does it mean?
EDIT == this is the query
update cities w, states s set w.region_id = s.id
where s.code = w.region and w.country_id = s.country_id
The cities table has around 3 million entries and the states table around 6000
Just for the record I executed this query using a mysql client Navicat.
SQL supports C-style comments:
/* ... */
so it looks like /*100,3 is being interpreted as the beginning of a comment and that comment is wrecking the syntax of the rest of the SQL.