Re: [web2py] Re: Delete a row from one table when two tables are joined

2017-02-23 Thread Mat Miles
Actually that solution was not quite correct. The one below is. if form.process(formname='form').accepted: rows = db(db.auth_user.location_id == auth.user.location_id).select(db.auth_user.id) db(db.shift_availability.created_by.belongs(rows)).delete() On Thu, Feb 23, 2017 at 12:57 PM, M

Re: [web2py] Re: Delete a row from one table when two tables are joined

2017-02-23 Thread Mat Miles
Thanks that worked. I have a shift_availability table and the auth_user table. The auth_user table contains a location. I want to clear all the rows in the shift_availability table but by location. Below is the solution: if form.process(formname='form').accepted: rows = db((db.shift_availabili

[web2py] Re: Delete a row from one table when two tables are joined

2017-02-22 Thread Dave S
On Wednesday, February 22, 2017 at 4:03:00 PM UTC-8, Mat Miles wrote: > > I need to create a join to limit the rows to be deleted. Is it possible to > delete a row from one table when a query joins two tables? > Not sure about the full answer, but a partial answer would be to use the join in a S