filter step 2 patr 1 + SQLs for patr 2