list:-type fields are a DAL abstraction (they are simply stored as pipe-delimited strings in the database), so it would be complicated to get the database to directly manipulate the contents of such fields. If you have the entire contents of the field, you can update the field without a select:
new_list = old_list.remove(some_id) # Somehow, you must already have old_list db(db.company.id == company_id).update(projects=new_list) Otherwise, you'll have to select and loop (though, note that you can select only the records that need to change): rows = db(db.company.projects.contains(some_id)).select(db.company.id, db. company.projects) [r.update_record(projects=r.projects.remove(some_id)) for r in rows] There are ways to do what you want via raw SQL (that would vary based on the RDBMS), but it may not be worth pursuing that optimization unless you find the above becomes a bottleneck in your application. Anthony On Tuesday, April 18, 2017 at 6:06:02 AM UTC-4, Sharjeel Ali Shaukat wrote: > > I have company table in which projects information is stored in > list:reference , now i want to remove the project id from company table > reference field without using loop , simple by DAL update query > > *Company Table* > | *id* | *name* | *projects* | > | 1 | Com1 | |1|2| | > > So after update my table should become > > > *Company Table* > | *id* | *name* | *projects* | > | 1 | Com1 | |2| | > > > > I need to write a update query that will remove project id from list > reference without using select query and for loop first > Thanks! > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.