merging in database