LibreOffice Base MySQL query gives error 1064 in phpMyAdmin
Amedee Van Gasse
amedee-ubuntu at amedee.be
Fri May 20 17:01:40 UTC 2011
I connected LibreOffice Base (3.3.2) to a local MySQL (5.1.54) database
and I made a bunch of queries with the query designer.
When I copy/paste these queries into phpMyAdmin (3.3.10deb1), I get an
error 1064 (SQL syntax error).
This is an example of a (working) query that I have in LO Base:
SELECT YEAR( "logfiledate" ), MONTH( "logfiledate" ),
"Sessions"."UserId", "Users"."Name", "Users"."FirstName", "Users"."Cat",
SUM( "Sessions"."TotalTime" ) FROM "loganalyser"."Sessions" AS
"Sessions", "loganalyser"."Users" AS "Users", "loganalyser"."Logfiles"
AS "Logfiles" WHERE "Sessions"."UserId" = "Users"."Trigram" AND
"Sessions"."LogFile" = "Logfiles"."logfile" AND YEAR( "logfiledate" ) =
? AND MONTH( "logfiledate" ) = ? GROUP BY "Sessions"."UserId" ORDER BY
SUM( "Sessions"."TotalTime" ) DESC
And this is what phpMyAdmin tells me:
#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 '."UserId", "Users"."Name",
"Users"."FirstName",
"Users"."Cat", SUM( "Sessions"."' at
line 1
SELECT YEAR( "logfiledate" ) , MONTH( "logfiledate" ) , "Sessions".
"UserId", "Users". "Name", "Users". "FirstName", "Users". "Cat", SUM(
"Sessions". "TotalTime" )
FROM "loganalyser". "Sessions" AS "Sessions", "loganalyser". "Users"
AS "Users", "loganalyser". "Logfiles" AS "Logfiles"
WHERE "Sessions". "UserId" = "Users". "Trigram"
AND "Sessions". "LogFile" = "Logfiles". "logfile"
AND YEAR( "logfiledate" ) = ?
AND MONTH( "logfiledate" ) = ?
GROUP BY "Sessions". "UserId"
ORDER BY SUM( "Sessions". "TotalTime" ) DESC
LIMIT 0 , 30
What's the most obvious thing to look at? I've been trying stuff for
some time now, and I have of course googled error 1064, but I don't see
what went wrong. One source indicated that I used a reserved word, but I
didn't find any of these words in my query:
http://dev.mysql.com/doc/mysqld-version-reference/en/mysqld-version-reference-reservedwords.html
More information about the ubuntu-users
mailing list