SQLTeam.com | Weblogs | Forums

SQL Stored Procedure to compare change in record


#1

Hello,

I have a stored procedure to track when shipment number is updated to a table.

The column name is Shipment Number. The values are either TDB (To be determined) or Shipping Number. I am writing a stored procedure that takes all the TDB values and writes it to a different table.

I need to go ahead and check that table and compare it to the other table and see if shipping number was changed from TDB to whatever. Any help on how to do this would be great.


#2

What column do the two tables have in common other than Shipping Number? You need something to join on.


#3

They have shipping ID in common


#4

so something like:

select *
from table1 t1
join table2 t2
 on t1.ShipID = t2.ShipID
where t1.ShipNum <> t2.ShipNum