Syntax error in MySQL WITH ROLLUP query in MySQL Workbench? - mysql

Any idea why the following query syntax is wrong:
SELECT year, sum(profit)
FROM BASEDATA b
group by year WITH rollup
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.....
MYSQL Version 5.0.77-community-log

It appears to be a bug in MySQL Workbench...the query runs fine under MySQL Query Browser.

Same error, but i found a discussion :
mysql WITH ROLLUP
if execute the query with ctrl+enter you get error, but if you execute with ctrl+alt+enter
then the query is ok!
Hope the fix this bug...

Related

Sql Syntax error with Doctrine, probably because of change of Mysql version

I've programmed a project in symfony and mysql 5.6. then I uploaded my project to a remote server on 1&1. the remote server has mysql 5.7 version. All doctrine queries run ok and without problem. But when a user searches something, a request will be sent to the server and a doctrine query will be executed. Here it returns the following error:
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 'integer)
BETWEEN 1940 AND 2002) AND u0_.id <> 2' at line 1
I think, it is probably because of different versions of mysql. Because on localhost it runs without problem
Can you please help me how to solve it? is there a way to regenerate all the migrations according the new mysql version? or may be there is another solution?
thanks
I was using CAST('number' as integer) in mysql 5.6. It did ok. However in mysql 5.7 and I do not know why, it does not run ok. So I changed it to CAST('number' as UNSIGNED) and it works ok

Unable to use UTC_TIMESTAMP with AS

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.

MySQL -Pentaho Error getting views from schema [null]

when trying to run Insert/Update or LookUp functions in Pentaho to get my SQL tables it shows me this error, anyone knows, how can I fix it?
Error getting views from schema [null]
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 'HAVING TABLE_TYPE IN ('VIEW',null,null,null,null) ORDER BY TABLE_TYPE, TABLE_SCH' at line 1
Downgrade your Mysql version compatible to Pentaho version. You should get that in your Pentaho manual.
I downgraded from mysql 8.0 to 5.6/5.5 and on 5.6 its got resolved.

Wordpress MySQL Syntax Error

Hi I'm having this MySQL error:
WordPress database 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 ')' at line 1]
SELECT file_name FROM art_uploaded_files WHERE file_number in()
here's the php line:
$file_name=$wpdb->get_results("SELECT file_name FROM art_uploaded_files WHERE file_number in(".substr($_files_id,0,-1).")");
I'm using this for php upload file.
The error is happening because $_file_id is empty.
So your query resulted to this:
SELECT file_name FROM art_uploaded_files WHERE file_number in()
Pay attention to the error message.
to work your query is supposed to look like this:
SELECT file_name FROM art_uploaded_files WHERE file_number in(1,2,3,4);

SQLYog automatically appending LIMIT 0, 1000 to all queries

SQLyog automatically appending LIMIT 0, 1000 to all queries in a database which is causing the below query (select next_hi from hibernate_unique_key for update) to fail.
Query : select next_hi from hibernate_unique_key for update **LIMIT 0, 1000**
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 'LIMIT 0, 1000' at line 2
The same is not happening in other database. Where to check and solve this problem?
UPDATE: It seems SQLyog is appending the LIMIT clause, no problem from hibernate or command prompt.
But it is happening in only one database not happening in the other database.
This was a bug which was fixed in SQLyog 8.4. SQLyog bug fix(8.4)-- On executing SELECT statements having clauses like PROCEDURE, INTO FILE, FOR UPDATE, etc., SQLyog was adding LIMIT clause if result tab paging option is enabled. The latest version of SQLyog can be found here.