Fix improper SQL syntax for status IN
Fix affiliate conversion rate function