Forum Discussion

DeepakSavanur's avatar
DeepakSavanur
Frequent Visitor
5 years ago

how do I create a table out of the differences

I have been trying to capture the log changes on a table from the previous day, so here is what i have done:

 

I import two latest file from a folder and then do left outer (all rows from both merge) and calculate the differences by adding custom column, as these files changes everyday i want to capture the rows that had a differences only on a table to create a log of changes.

 

example data

 

file 1                                                                                              file 2

 

item      cost          type                                                                item            cost            type

car        600           toy                                                                  car              899             toy

Radio    200           electronics                                                       Tv               300             electronics

mobile   300          electronics                                                      mobile         300             electronics

 

combined table 

 

item          cost          type             table2.item            table2.cost                table2.type        difference in cost        differenceitem 

car             600          toy                car                          899                          toy                           299                            0

null             null        null                 Tv                           300                         electronics               -300                           TV

radio          200        electronics      null                         null                         null                           200                            radio

mobile       300        electronics      mobile                    300                         electronics                0                                0

 

 

now here i want to create a table out of first three rows which had difference from last file and would like to append these difference everyday on a table so i have a log of changes happening everyday 

2 Replies