sql update table from subquery