Merge the SQL