mysql version 5.0.95 and concat issues - mysql

I have the following query running under Mysql Version 5.0.95 - I cannot change the server as it is under company's descition when to upgrade
trying to run it
SELECT * FROM table1 WHERE UPPER(CONCAT_WS(' ', `firstname`, `lastname`) LIKE UPPER('%Test User%')
and getting this error
[Err] 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

Related

MySQL 8.0 not being able to create any query plans

I have a very simple query:
explain
select *
from mytable
limit 1
And I cannot see the execution plan, I receive this error:
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 'explain select * from mytable limit 1' at line 1
Why doesn't this work?

Error Code: 1064 - You have an error in your SQL syntax

I have a very strange problem with this code:
Update creature_template SET health_min=(health_min * 0.03) where entry in (select entry from creature where rank ='1');
Update creature_template SET health_max=(health_max * 0.03) where entry in (select entry from creature where rank ='1');
Error occured at:2021-01-07 13:27:46
Line no.:1
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 '='1')' at line 1
I use mysql 8.x and I am a beginner. in mysql 5.x this problem does not exist.
Anyone if can help i would be grateful.
rank is a reserved word in MySQL since version 8.0.2. You need to escape it with backticks
... where `rank` = '1' ...

My sql query shows an error when updating a date value with dateadd() function

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 ') where id_hotel=6 and id=70739' at line 1
query
update prenotazione_h
set camera=202, dal ='2017-11-23', al=dateadd('2017-11-23',INTERVAL 5 DAY)
where id_hotel=6 and id=70739;

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

i got an error while im trying to execute query views in mysql version 5.7.19
Here is my query :
CREATE ALGORITHM=UNDEFINED DEFINER=`acc_webdev`#`%` SQL SECURITY DEFINER VIEW `view_dash_total` AS
SELECT
COUNT(0) AS `jumlah`,
SYSDATE() AS `tanggal`
FROM `table_laporan`
WHERE (STR_TO_DATE(`table_laporan`.`dt_added`,'%d-%m-%Y') < (SYSDATE() + INTERVAL - (1)DAY))$$
and got 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 '$$' at line 6
but in mysql 5.1.25, there's no error when i execute the query above
please help me out
Either prepend your DDL with DELIMITER $$ or just change your delimiter to ;.
Read more about delimiters here
Try This:
CREATE VIEW `view_dash_total` AS
SELECT
COUNT(0) AS `jumlah`,
SYSDATE() AS `tanggal`
FROM `table_laporan`
WHERE (STR_TO_DATE(`table_laporan`.`dt_added`,'%d-%m-%Y') < (SYSDATE() + INTERVAL - (1)DAY));

Mysql syntax error : 'WHERE NOT LIKE'

I'm trying to track the page views by inserting only unique values every 24h.But when I run this query I get a syntax error.
insert ignore into profilepageviews values( '77.777.777.777' , CURRENT_TIMESTAMP, '5') where hitdate NOT LIKE '%2012-06-26%'
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 'where hitdate NOT LIKE '%2012-06-26%'' at line 1
You can not use WHERE clause with INSERT, You might want UPDATE