2

I have a very strange sqlite syntax error.

const char *statement = "DELETE FROM quotes t1 WHERE t1.id=127";
int returnCode = sqlite3_exec(database, statement, NULL, NULL, &errorMsg);
if (returnCode!=SQLITE_OK) 
{
    fprintf(stderr, "Error: %s", errorMsg);
    sqlite3_free(errorMsg);
}

 Error: near "t1": syntax error

But this code works well

const char *statement = "DELETE FROM quotes WHERE id=127";
int returnCode = sqlite3_exec(database, statement, NULL, NULL, &errorMsg);

1 Answer 1

5

SQLite doesn't allow aliases in delete statements.

See the manual for the allowed syntax.


delete-stmt

enter image description here

qualified-table-name

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.