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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to Select info from table that is not found in another table

Status
Not open for further replies.

VBSQL

Programmer
Jun 14, 2001
2
US
I have two tables that are linked with the same ID number's
One holds Orderinfo and the other Iteminfo, I need to SELECT the ID's that are in the table with the Orderinfo where the ID does not exist in the Iteminfo table and then remove it from the Orderinfo table. All of this is being done with in a VB Program using recordsets. Do You Have any Ideals to help!

Thanks.
 
You can do what you want with two SQL statements.

First statement to select records for archiving, documentation, etc.

Select OrderInfo.*
Where ID Not In (Select ID From Iteminfo)

Second statement deltes non matching records.
Delete OrderInfo
Where ID Not In (Select ID From Iteminfo)
Terry

The reason why worry kills more people than work is that more people worry than work. - Robert Frost
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top