Fixes sql as @tdeekens can't write simple sql.