fix agent double
unknown
pgsql
19 days ago
824 B
3
Indexable
Never
-- check apakah ada dengan agent id tersebut select agent_id from advertises where agent_id = (select id from agents where email = 'richapropertibali@gmail.com'); -- jika tidak ada maka bisa delete dibawah ini delete from agents where office_id = (select id from office_agents where office_agents.email = 'richapropertibali@gmail.com') and is_pic = true; delete from partners where email = 'richapropertibali@gmail.com'; -- namun jika ada maka --masukan id agent yg engga boleh di hapus; delete from agents where office_id = (select id from office_agents where office_agents.email = 'richapropertibali@gmail.com') and is_pic = true and id != 0; --masukan id agent yg engga boleh di hapus; --masukan id agent yg engga boleh di hapus; delete from partners where email = 'richapropertibali@gmail.com' and agent_id != 0;
Leave a Comment