db(~db.people.name.belongs(namelist)).delete()

Anthony

On Thursday, October 9, 2014 1:45:23 PM UTC-4, Niels Jensen wrote:
>
> Hi,
>
> I have a list of names
> namelist = ['Niels', 'Bob', 'Frank', 'Pat', 'Ann']
>
> I'd like to remove all records from a table where the name field does not 
> have a name in the list.
> For example if all the above exist in the table 
> Is there a function to do this or will I need to loop through each row in 
> the table. I was thinking something like this might work?
>
>
> rows = db(db.people.name != namelist).select()
> del db.mytable[rows]
>
>
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to