Hi ,
I am trying some way to optimize following sql statement:
exe_sql "DELETE FROM tblEvent_type WHERE eguid in (SELECT rowid FROM tblEvent_basic WHERE sguid=11);";
exe_sql "DELETE FROM tblEvent_group WHERE eguid in (SELECT rowid FROM tblEvent_basic WHERE sguid=11);";
It is said that sqlite3 did not perform well in subquery and notice that above two sql excuted "(SELECT rowid FROM tblEvent_basic WHERE sguid=11)"` twice ,so I'd like to try to split the subquery to something like below:
result = exe_sql "(SELECT rowid FROM tblEvent_basic WHERE sguid=11);";
exe_sql "DELETE FROM tblEvent_type WHERE eguid in (result)
exe_sql "DELETE FROM tblEvent_group WHERE eguid in (result)
How could achieve this? I have no idea how to get the parmater (result) binding to follwing statment in sqlite.
"DELETE FROM tblEvent_group WHERE eguid in (?) #how to bind result here
I am using sqlite3 C API directly.