LibreOffice Base MySQL query gives error 1064 in phpMyAdmin
Keith Clark
keithclark at waterloosubstop.com
Fri May 20 19:46:18 UTC 2011
On Fri, 2011-05-20 at 21:27 +0200, Amedee Van Gasse wrote:
> On 05/20/11 19:56, Daniel Kreuter wrote:
> > Hello,
> >
> > did you try ' instead of " ? Another thing i find a little bit strange
> > are the ? in the query, i never used them and i don't know if they are
> > allowed in mysql or if they even exist in sql???
>
> Drats! Those question marks are query parameters...
>
> But still, if I change the query to:
>
> 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' ) =
> '2011' AND MONTH( 'logfiledate' ) = '12' GROUP BY 'Sessions'.'UserId'
> ORDER BY SUM( 'Sessions'.'TotalTime' ) DESC
>
> Then 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' ) = '2011'
> AND MONTH( 'logfiledate' ) = '12'
> GROUP BY 'Sessions'. 'UserId'
> ORDER BY SUM( 'Sessions'. 'TotalTime' ) DESC
> LIMIT 0 , 30
>
Take the quotes out altogether.
Keith
More information about the ubuntu-users
mailing list