Menu

Why does the ORDER BY give the syntax error in command editor?

wyattb
2013-02-22
2013-02-23
  • wyattb

    wyattb - 2013-02-22

    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

     
  • Anu

    Anu - 2013-02-22

    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

     
  • wyattb

    wyattb - 2013-02-23

    Cannot reproduce it now but you are probably right. As long as I am aware of the issue.

    Thanks

     

Anonymous
Anonymous

Add attachments
Cancel