Given the following tables:
acl (acl_id integer, name character)
ace (acl_id integer, users_id integer)
users (users_id integer, login character)
And some sample data:
acl (0, 'view') (1, 'sell'), (2, 'void')
ace (0, 9), (1, 9), (2, 9), (0, 8)
users (8, 'joe') (9, 'john')
I attempted the following:
DELETE FROM ace
WHERE ace.acl_id = acl.acl_id AND acl.name = ?
AND ace.users_id = users.users_id AND users.login = ?
but this fails in sqlite3_prepare_v2()
with SQLITE_ERROR "no such column: acl.acl_id" (which isn't very helpful)
I get the same result with:
DELETE FROM ace
WHERE acl_id = acl.acl_id AND acl.name = ?
AND users_id = users.users_id AND users.login = ?
Thankfully, the scary:
DELETE FROM ace,acl,users
WHERE ace.acl_id = acl.acl_id AND acl.name = ?
AND ace.users_id = users.users_id AND users.login = ?
fails with a syntax error on the first comma.
If I got far enough to bind the values 'sell' and 'john' to the parameters, and to step the query, then I would expect the (1, 9) row of the ace table to be deleted.
Is this possible to accomplish without doing two SELECTs first to get the acl_id and users_id values?