Improved the query for working around Sequel's paranoia problem