Flatten the SQL result set so that the array difference actually works.