Unable to use UTC_TIMESTAMP with AS - mysql

I'm getting a syntax error while using UTC_TIMESTAMP
Here is my query:
select UTC_TIMESTAMP() as utc_timestamp;
This is the error I'm getting
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 'utc_timestamp' at line 1
What is going on here?
If I just do SELECT UTC_TIMESTAMP() it works.

The problem is you're naming it incorrectly. MySQL thinks utc_timestamp is a function call similar to UTC_TIMESTAMP.
Use my_utc_timestamp and it should work.

Related

Update ERROR Mysql

UPDATE User SET username='basta2',password=sha2('basta',512), role='User' disabled=0 WHERE username='basta';
This query should be correct in my opinion, but gives 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 'disabled=0 WHERE username='basta'' at line 1
What is wrong here?
As pointed by #vkp, the issue is a missing ,. Use this:
UPDATE User SET username='basta2',password=sha2('basta',512), role='User', disabled=0 WHERE username='basta';

odbcException was unhandled

ERROR [42000] [MySQL][ODBC 5.1 Driver][mysqld-5.0.45-community-nt]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 petugas where nama='ANTON', and kode_petugas='ADM01'' at line 1
how to resolved it problem.
I think you have used , or at the end of line ADM01 not ADM01, thats the error.
use following query,
from petugas where nama='ANTON' and kode_petugas='ADM01'

Mysql Collation does not work

I insert some text which i scrap from remote server and the problem is that in the text here is symbol.
� which makes a syntax error insert doe not work .Any ideas about this a
paradox????? I've tried almost all collation nothing works.Text is in armenian.
SQLSTATE[42000]: Syntax error or access violation: 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
Thanks in advance
FIXED..!!!The problem was when create an instance of PDO I didn't mention this part
charset=utf8

Can't find out what's wrong with this MySQL event syntax

I'm trying to create a MySQL event, and this is the syntax I'm using:
CREATE EVENT test
ON SCHEDULE AT FROM_UNIXTIME(1428005286)
DO
BEGIN
UPDATE blog_posts SET status = 'published' WHERE id = 5;
END
When I run it on Node.js (with the mySQL adapter, under Sails.js), I get no error, but the event doesn't get created. When I run it directly through phpMyAdmin, I get:
#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 5
I have also tried adding a semicolon to END, making it END;, and removing all semicolons, and it returns a slightly similar 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 'END' at line 6
I have no idea why this is happening. Any help is appreciated. Thanks.
You probably need to start with: create DEFINER=root#localhost ...
Also, since this is a one-liner, you don't need BEGIN..END

Can't create a view using the views module

I created a view using Views module based on the default node index. But the first thing I found is this error message:
SQLSTATE[42000]: Syntax error or access violation: 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 OFFSET 0' at line 2
What might cause this and how do I solve it?
You have an error in your SQL syntax !
View module just GUI for create query
so you be sure your choice was Logical for create a query