Chaining search params with sql subqueries