الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

delete identically rows from two tables

مغلق
بدأه هشام سعد في 7 أبريل 2004 · 1 رد · 565 مشاهدة · في قواعد بيانات Microsoft SQL Server
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

hi, We have two tables with the same structure some users insert data in the first table and the others insert the same data into the another table the all users can duplicate insert the data again by mistak .. there is no uniqe index , no foreign key ,no primary key ..So I want to delete the identically rows which inserted into two tables and display the records which inserted in one table and not inserted in another table as this example:

table A , table B

1 , 1

1 , 1

1 , 2

2 , 2

2 , 2

3 , 4

5 , 5

7 , 6

8 , 6

6 , 8

and I want the result will be :

1 , 4

3 , 2

7 , 6

thanks.

#2

باالنسبة لسؤالك الأول حول حذف الأسطر الغير فريدة أنظر الرابط التالي:

http://www.4guysfromrolla.com/webtech/sqlg...q051200-2.shtml

أما السؤال الثاني فبإمكانك إستخدام الـ SQL statement التالية:

select TABLE1.ID

from TABLE1

where((not exists(select TABLE2.ID from TABLE2

where TABLE2.ID=TABLE1.ID))

)

هذا الموضوع مغلق.

مواضيع مشابهة