I am losing my touch here. In the old days I would come up with a super T-SQL query,
Select t1.Number, t1.TransactionType, t1.Description, t1.Vendor, (Select max(t2.BatchId) From table2 t2 Where t1.Number=t2.Number and t1.TransactionType=t2.TransactionType Group By t2.number,t2.transactiontype) As BatchId From table1 t1
I need a second column from table2. Column is called "Result".
Example:
table1: Number, TransactionType, Description, Vendor 1, Type1, Test1, Vendor1 2, Type1, Test2, Vendor2 1, Type2, Test3, Vendor3 3, Type2, Test1, Vendor2 table2: Number, TransactionType, BatchId, Result 1, Type1, 12, error1 1, Type1, 4, error2 1, Type2, 8, success 3, Type2, 7, success wanted ResultSet: Number, TransactionType, Description, Vendor, BatchId, Result 1, Type1, Test1, Vendor1, 12, error2 2, Type1, Test2, Vendor2, null, null 1, Type2, Test3, Vendor3, 8,success 3, Type2, Test1, Vendor2, 7,success
The posted query takes care of the first 5 columns. Now how about that last column?