从引用两个不同表的列中删除一个值。 [英] Delete a value from a column referred to two different tables.

查看:51
本文介绍了从引用两个不同表的列中删除一个值。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当列值引用两个不同的表时,如何从表中的列中删除值。



此处需要使用Joins


我尝试了什么:



尝试谷歌搜索没有得到任何具体的东西

How would you delete a value from a column in a table when that column value refers to two different tables.

Need a SQL Query here using Joins

What I have tried:

Tried Googling Not getting anything specific

推荐答案

对我来说已经有一段时间但是......尝试这样的事情:



has been a while for me but.. try something like this:

DELETE FROM table1 t1, table2 t2
WHERE t1.id = 1 AND t2.parent_id = t1.id



请知道此方法是否有效,i我不是100%肯定


Please let know if this method works, i am not 100% sure


这篇关于从引用两个不同表的列中删除一个值。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆