dimanche 13 mars 2016

SQLite delete a specific row java swing

I'm trying to delete a specific row from a table, and I can't find the way to do it.

I was following http://ift.tt/1SKP31Z but it didn't work.

my query is:

        String query = "delete from " + type + " where name=? and score =? (SELECT score FROM " + type + " ORDER BY score DESC LIMIT 1)";
        pst.setString(1, tempName); 
        pst.setInt(2, tempScore);

The string "type" is the table name (no bugs with the table name) and in the table I have to rows: name and score. and pst is the prepared statement.

The error I get: "[SQLITE_ERROR] SQL error or missing database (near "(": syntax error)".

What am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire