SQL Overwrite Id compliant query