如何一次从3个表中删除记录 [英] How to delete record from 3 table at time

查看:82
本文介绍了如何一次从3个表中删除记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友
我有三个表,我想通过信号查询从三个表中删除记录
我已经尝试过但是却出错了?
任何哥们都可以帮我做什么 ?????????

hello friends
i have three table and i want to delete record from three table by signal query
i have try this but getting error ?
can any buddy help me what i have to do?????????

cmd .CommandText =("DELETE FROM (ITEMMAST x INNER JOIN SAUDAMAST y)INNER JOIN PITBROK Z  ON x.ITEMCODE = y.ITEMCODE=Z.ITEMCODE WHERE ITEMCODE='" + textBox1.Text + "'");
cmd.ExecuteNonQuery();
MessageBox.Show("RECORD DELETED", " ", MessageBoxButtons.OK, MessageBoxIcon.Information);

推荐答案

您好lakhan ,
在单个查询中从多个表中删除 [
Hi lakhan,
Delete from multiple tables in a single query[^]




您可以为其他引用表的表定义外键约束
主表的主键带有ON DELETE CASCADE.这会导致
这些表中要删除的相关行.请参阅下面的讨论线程,
http://forums.whirlpool.net.au/archive/560152 [
Hi,

You could define Foreign Key constraints for the other tables that reference
the master table''s primary key with ON DELETE CASCADE. This would cause the
related rows in those tables to be deleted. See the discussion thread below,
http://forums.whirlpool.net.au/archive/560152[^]


这可能对您有帮助

http://www.dbasupport.com/forums/showthread.php?t=11441 [ ^ ]

> http://stackoverflow.com/questions/4839905/mysql-delete- from-multiple-tables-with-one-query [ ^ ]
This may help you

http://www.dbasupport.com/forums/showthread.php?t=11441[^]

http://stackoverflow.com/questions/4839905/mysql-delete-from-multiple-tables-with-one-query[^]


这篇关于如何一次从3个表中删除记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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