single window pay with ba made more efficient with sql