By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,140 Members | 1,301 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,140 IT Pros & Developers. It's quick & easy.

Removing records from one tables that common in other table.

P: n/a
Must be very simple but don't know how to delete records.

I have two tables A, and B. Table A has total 7926 records. 3126
records out of these 7926 is in table B. I need to remove these 3126
records from Table A.

Thanks.
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Habibullah wrote:
Must be very simple but don't know how to delete records.

I have two tables A, and B. Table A has total 7926 records. 3126
records out of these 7926 is in table B. I need to remove these 3126
records from Table A.

Thanks.

DELETE
FROM
[Table A] As a
WHERE
EXISTS (SELECT * FROM [Table B] WHERE ID = a.ID)

--
'-------------------------------
' John Mishefske
'-------------------------------

Nov 12 '05 #2

P: n/a
mi*****@uci.edu (Habibullah) wrote in message news:<7e**************************@posting.google. com>...
Must be very simple but don't know how to delete records.

I have two tables A, and B. Table A has total 7926 records. 3126
records out of these 7926 is in table B. I need to remove these 3126
records from Table A.

Thanks.


Remove all records from table A that are in table B....

DELETE TableA.SomeNumber
FROM TableA INNER JOIN TableB ON TableA.SomeNumber = TableB.SomeNumber;
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.