Hi,
I`m not sure , Whether i have understood your query or not.
if i would have understood your query , attached application would be the solution.
Create duplicate kampainId in both transaction table and campign table and compare bothe the id as such i have done in my sample application.
Have a look at my application, you`ll get clear picture.
Good luck 
- Sridhar