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

Reading from multiple tables

Status
Not open for further replies.

balachandar

Programmer
Apr 16, 2001
88
CA
We have two tables A,B. periodically we are moving data
from A to B(all columns).A and B have the same column name.
at a given point of time, if a record is not there in A, then from B we need to take a record for processing.is there
any easy way to do this.
 
Use the EXISTS keyword and match up each column, or the PK

i.e.

select * from b where not exists (select * from a where a.pk = b.pk)

you can apply this to in lots of different ways - in if statements etc

So you could have something to the effect

if not exists in A then go to B else goto A
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top