UcanaccessSQLException: unexpected token: ORDER

I am making a small application in Java and MySQL with PHPMyAdmin and everything works fine, but my professor says that we should work with the database in Access, so I just changed my connection to the class and imported my database. Operators INSERT, SELECTand others UPDATEwork fine, but this operator simply does not start.

UPDATE table SET col1=?, col2=? WHERE col0=? ORDER BY col4 DESC LIMIT 1

I can’t understand how it works fine in MySQL, but it doesn’t work with UCanAccess.

+4
source share
1 answer

I can’t understand how it works fine in MySQL, but it doesn’t work with UCanAccess.

, SQL , SQL-, MySQL, Access Microsoft SQL Server Oracle, "" SQL.

UCanAccess Access SQL. Access SQL TOP n LIMIT n, Access SQL TOP n ORDER BY UPDATE. , , .

, "id",

sql = 
        "UPDATE table1 SET col1=?, col2=? " +
        "WHERE id IN ( " +
            "SELECT TOP 1 id " +
            "FROM table1 " +
            "WHERE col0=? " +
            "ORDER BY col4 DESC, id " +
        ")";
+2

All Articles