> I don't believe there is an option to "select into" in SQLite. So your
> first statement should probably be a "create as". Also, you should
> delete the temp table after the delete. Your solution should read like this:

Oops! Too many database syntax records in my head at the same time!

>
> create temp temp_table as
>     select id from source_table where some_condition = true;
> delete from source_table
>     where id in (select id from temp_table);
> drop temp_table;
>
> But I have to wonder why you suggest creating the temp table at all when
> this does the same thing:

He said he wanted to do some processing before deleting the records.

I do something similar when printing letters from a live system. I
take a snapshot
into a temp table, export the data to the printing process, and then
if that suceeds
I mark the records as printed using the temp table. If I didn't use a
snapshot records
added while the process runs will be marked as printed when they really are not.

Reply via email to