[Tutor] sqlite3 does it support limit in a delete clause?

Jim Byrnes jf_byrnes at comcast.net
Fri Feb 22 15:57:48 CET 2013


On 02/21/2013 11:10 PM, eryksun wrote:
> On Thu, Feb 21, 2013 at 8:47 PM, Jim Byrnes <jf_byrnes at comcast.net> wrote:
>>
>>>>> cur.execute("delete from pwds where Account='xMe' limit 1")
>
> If you need a alternate way to limit the delete, try the following,
> for which the limit is on a select query:
>
>      cur.execute('''
>        delete from pwds where rowid in (
>          select rowid from pwds where Account='xMe' limit 1)
>      ''')

Thanks for all the info.  I ran your tests and my version of sqlite3 is 
indeed not compiled to use LIMIT.  After I sent the email I was 
wondering about using rowid.  Thanks for confirming it with an example.

Regards,  Jim



More information about the Tutor mailing list