473,386 Members | 1,804 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,386 software developers and data experts.

Delete Non Matching Records

Hi all,

I have two tables that are related to each other.
One has 30K records while the other has 500.
I ran a 'Without Matching' query to find records in the larger table
that didn't have a matching record in the smaller table, however now I
want to delete those records. Is there an easy way to do this?

Thanks,
Bill

May 2 '06 #1
3 3044
turn the select query into a delete query?

May 2 '06 #2
Great! Thanks so much. Works just fine.

(Just goes to show how much I have to learn!)

Bill

May 2 '06 #3
kl*****@hotmail.com wrote:
I have two tables that are related to each other.
One has 30K records while the other has 500.
I ran a 'Without Matching' query to find records in the larger table
that didn't have a matching record in the smaller table, however now I
want to delete those records. Is there an easy way to do this?


Bill - not a direct answer to your question, but I would refer you to
the recent "Relationships. Does anyone use them?" thread. After you've
gotten rid of your orphaned records, to avoid future occurances, set up
a relationship to enforce referential integrity between the two tables.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
May 2 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Philip Mette | last post by:
I have been searching many postings and I cant seem to find anyone that has this answer so I decided to post. I am using SQL (Transact-SQL).If I have 2 tables with columns...
2
by: laurenq uantrell | last post by:
I'm hoping someone can tell me how to construct a stored procedure that deletes all records in tblA not matching the PK in tblB This gives me the recordset of all records in tblA with no matching...
3
by: Earl Teigrob | last post by:
I am considering writing a Class that Selects, Adds, Updates and Deletes Nodes in an XML File but do not what to reinvent the wheel. (See XML file below) That data format would emulate records...
10
by: D. Dante Lorenso | last post by:
I'd like to run a clean up command on my tables to eliminate rows that I'm no longer using in the database. I want to do something like this: DELETE FROM tablename WHERE...
9
by: Robert Schneider | last post by:
Hi to all, I don't understand that: I try to delete a record via JDBC. But I always get the error SQL7008 with the error code 3. It seems that this has something to do with journaling, since the...
2
by: Joe Del Medico | last post by:
I have two tables A & B and I want to delete all the records in A that are not in B. Can I do this in the query builder? It seems like a simple problem. I can easily find the records in A that...
0
by: debulle | last post by:
Hello, can somebody help. I've got one table (table1) with articleID, StoreID, DateFrom, DateTo and another table (table2) which has the exact layout, but holds a limited number of records. I...
2
by: Phil Stanton | last post by:
Deleting a record on a membership form. Does some VB checks to see if the family are still in the list. Warns me there is no going back if I delete the record, so I say OK and it appears to delete...
3
by: Phil Stanton | last post by:
I have a form based on a complex query (Lots of tables) If I delete a record, everything appears to be OK. Get the message "Youa are about to delete 1 record ....". I say yes. The record count...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.