com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'CompanyCategories.CategoryId ASC' at line 1
SELECT
CategoryReporting.CategoryName,
CompanyCategories.CompanyId,
CompanyCategories.CategoryId,
CategoryReporting.ReportingFreq,
CategoryReporting.ReportingPeriodName,
CategoryReporting.ReportingCloseDate,
CategoryReporting.SurveyStartDate,
CategoryReporting.SurveyDueDate,
CategoryReporting.SurveyDescription
FROM
CategoryReporting INNER JOIN CompanyCategories ON CategoryReporting.CategoryId = CompanyCategories.CategoryId
WHERE
CompanyCategories.CompanyId = "WAS-1035-00"
AND CategoryReporting.ReportingFreq = "M"
ORDER BY
CompanyCategories.CategoryId ASC
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The SELECT below works fine when I run it with other tools but gves error i SQLLeo
*** MySQL.new database name@itrdata_root ***
CompanyCategories.CategoryId ASC
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'CompanyCategories.CategoryId ASC' at line 1
SELECT
CategoryReporting.CategoryName,
CompanyCategories.CompanyId,
CompanyCategories.CategoryId,
CategoryReporting.ReportingFreq,
CategoryReporting.ReportingPeriodName,
CategoryReporting.ReportingCloseDate,
CategoryReporting.SurveyStartDate,
CategoryReporting.SurveyDueDate,
CategoryReporting.SurveyDescription
FROM
CategoryReporting INNER JOIN CompanyCategories ON CategoryReporting.CategoryId = CompanyCategories.CategoryId
WHERE
CompanyCategories.CompanyId = "WAS-1035-00"
AND CategoryReporting.ReportingFreq = "M"
ORDER BY
CompanyCategories.CategoryId ASC
Hello,
You should have space or line escape after ORDER BY
I guess your syntax executed like this
ORDER BYCompanyCategories.CategoryId ASC - as the error explains.
Instead you should have like this
ORDER BY (enter)
CompanyCategories.CategoryId ASC
(or)
ORDER BY CompanyCategories.CategoryId ASC
It can problem of OS, may be you can confirm.
Regards
Anudeep
Cannot reproduce it now but you are probably right. As long as I am aware of the issue.
Thanks