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
Related
SELECT sma_quotes.customer as name,
sma_quotes.date as date,
sma_quotes.selecttype as type,
sma_quotes.biller_id as bl_id,
sma_quotes.volume as volume,
sma_quotes.containernumber as cn_no,
sma_quotes.grand_total as total,
sma_sales.paid as paid
FROM sma_quotes
JOIN sma_sales ON sma_sales.quote_id = sma_quotes.id
WHERE name IS 'Everbest Foods'
Error
SQL query: Documentation
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 ''Everbest Foods' LIMIT 0, 25' at line 1
There is no LIMIT in your query, so the error message is suspicious.
However, you want =, not IS:
WHERE sma_quotes.customer = 'Everbest Foods'
I just wanted to switch from sqlite3 to using MySQL but I get errors in this query:
SELECT
metapp_notif.id,
name,
age,
place,
note,
metapp_notif.lat,
metapp_notif.longt,
haslatlong,
dati,
ntype,
grpm_id,
image,
send_id,
pro.latitude,
pro.longtitude,
metapp_notif.dati,
metapp_notif.activity
FROM (metapp_notif
join (metapp_profil
join metapp_userlocation
ON metapp_profil.user_id = metapp_userlocation.user_id) AS pro
ON metapp_notif.send_id = pro.user_id)
WHERE metapp_notif.rec_id =% d;
I'm getting this 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 'pro on metapp_notif.send_id=pro.user_id) where
metapp_notif.rec_id=2' at line 1
I was searching for differences between sqlite3 and mysql but can't figure out what is wrong.
Thanks in advance!
Try this syntax in Mysql
SELECT metapp_notif.id,
name,
age,
place,
note,
metapp_notif.lat,
metapp_notif.longt,
haslatlong,
dati,
ntype,
grpm_id,
image,
send_id,
latitude,
longtitude,
metapp_notif.dati,
metapp_notif.activity
FROM metapp_profil
join metapp_notif
ON metapp_notif.send_id = metapp_profil.user_id
join metapp_userlocation
ON metapp_profil.user_id = metapp_userlocation.user_id
WHERE metapp_notif.rec_id like '% d'; -- Not sure what you are trying to do here
Im looking to add all products that dont have attribute_id = 12 into oc_product_attribute,
But getting a syntax 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 '12) select ocp.product_id from oc_product ocp where ocp.product_id not in (SE' at line 1
insert into `oc_product_attribute` (ocp.product_id, 12)
select ocp.product_id from oc_product ocp where ocp.product_id not in (SELECT oca.`product_id`
FROM `oc_product_attribute` oca where oca.attribute_id = 12)
Am I missing something here, quite new to SQL.
Usually you have to enumerate columns in insert statements.
insert into `oc_product_attribute` (ocp.product_id, 12)
must be
insert into `oc_product_attribute` (ocp.product_id, some_column_name)
and I guess it may be attribute_id.
For more details, please see the reference manual -> http://dev.mysql.com/doc/refman/5.6/en/insert-select.html
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/'
select count (*) from sales_order where date_format
(created_at,'%Y-%m-%d') >=
'2009-11-02' and date_format(created_at,'%Y-%m-%d')
<= '2010-12-08' and customer_id in
(14,1113,1115,1117,1132,1312,1345);
it gave me this 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 '*) from sales_order where
date_format(created_at,'%Y-%m-%d') >= '2009-11-02' and' at line 1
Please let me know where is the problem
No space allow for count (*)
count(*)
The issue is with the space after COUNT. Do not use a space here. See this MySQL bug: Bug #2664 An extra space after Count in a Count(distinct... statement fails