Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Statement 1

Status
Not open for further replies.

brians0friends

Technical User
Feb 6, 2002
4
US
For example sake I have put numbers within () to better explain my needs.


I need to sort table(1) by field(3) then compare SSN in field(1)from table(1) to table(2) field(2, also containing SSN). If match, in table(2), then delete entire row containing matching SSN in table(2).
 

Use SQL statements which handle this without the procedural steps - sort, match, delete... You can do everything with one SQL statement because SQL works on Sets of data.

Delete table2.*
From table2 Inner Join table1
On table2.field2=table1.field3;

Alternate statement:

Delete table2.*
From table2
Where field2 In (Select field3 From Table1); Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top