Update query to get primary key