adding sql and merging