I have to tables connected with two field called vpid. The field id which is in the table bo_vp is the unique row. One row in bo_vpid can be connected to several rows in bo_vp.
What I'm trying to do is to delete a row in bo_vp by specifying "where id =". I want to delete the row in bo_vpid when all id's in bo_vp is deleted. Instead of deleting one id, checking if more id's exist with the same vpid and then if no id's with that vpid exist delete the row from the bo_vpid. I have tried this but it didn't work;
delete from (select * from bo_vp v, bo_vpid f where f.vpid = v.vpid) k where k.id = 140
Do you have any suggestions? Thank you!
/ Henrik
What I'm trying to do is to delete a row in bo_vp by specifying "where id =". I want to delete the row in bo_vpid when all id's in bo_vp is deleted. Instead of deleting one id, checking if more id's exist with the same vpid and then if no id's with that vpid exist delete the row from the bo_vpid. I have tried this but it didn't work;
delete from (select * from bo_vp v, bo_vpid f where f.vpid = v.vpid) k where k.id = 140
Do you have any suggestions? Thank you!
/ Henrik