473,406 Members | 2,954 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Some body write a query for me.....

i have two same table in a same database. the table dosent have any keys. My query is if u delete one record from one of the table the i should i write aquery to delete the same row in the other table.

some body help mee....
Oct 8 '07 #1
3 961
azimmer
200 Expert 100+
i have two same table in a same database. the table dosent have any keys. My query is if u delete one record from one of the table the i should i write aquery to delete the same row in the other table.

some body help mee....
How would you know (if you'd do it by hand) which row to delete from the other table?
Oct 8 '07 #2
iburyak
1,017 Expert 512MB
i have two same table in a same database. the table dosent have any keys. My query is if u delete one record from one of the table the i should i write aquery to delete the same row in the other table.

some body help mee....
1. Lets assume you already deleted row from table1 and trying to delete not existed records from table2

[PHP]delete from table2 where not exists(select * from table1 where col1 = table2.col1 and col2 = table2.col2 and col3 = table2.col3 ..... )[/PHP]

2. You can do it from ‘For Delete’ trigger

[PHP]Delete from table2 from table2 a join deleted d on a.col1 = d.col1 and a.col2 = d.col2 and a.col3 = d.col3 ….. [/PHP]

Good Luck.
Oct 8 '07 #3
Using a unique value in two tables can eliminate the rows that u need.
Oct 10 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Mario Leduc | last post by:
Hi, I have a page that sends user comments with CDONTS, works fine. Until I put a URL (http://192.168.0.1). If I use http://domain.com it works fine. Why with the numeric URL, CDONTS does not...
1
by: D2CAD | last post by:
I want to make this work... This is my script-file(.js): function showText() { theText = window.textFile.document.body.innerHTML.replace(/\<+\>/gm, ""); } function...
1
by: D2CAD | last post by:
function productprice(img,titel,path,bestand1) { features = 'toolbar=yes,location=no,directories=no,status=no,menubar=no,' + 'scrollbars=yes,resizable=no,width=680,height=600' dlg = window.open...
3
by: Newsscanner | last post by:
Hello, Everything is beginning to work, but there are still a few issues left. Please forgive my ignorance and hence stupid questions (Newbie). I can now enter data with no problem, I get no...
39
by: Digital Puer | last post by:
I'm not the world's greatest C++ programmer, so I had a hard time with these. Some help would be appreciated. 1. Comment on the declaration of function Bar() below: class Foo { static int...
3
by: whatsoever | last post by:
hi i have made a database let say estate agent which have 5 table and 10 queries i have connected it with php using the tutorial in w3school <html> <body> <?php $conn=odbc_connect('db','','');...
13
by: phobia1 | last post by:
The simple code below gets data from a Location field and puts them into a lisbox. What I want to do is to be able to select one from the list and run a new function. How to get $areasearch valid?...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.