changing to use the correct database
changing to use datamart, even though the tables don't exist there since we will migrate everything from datamart to a new fancy database
rewriting to use statsdb and fluent sql
updating to use statsdb and fluent sql
fixing database name
removing unused variables
adding support for grouping conditions in another condition ex: WHERE col1=5 AND (col2=3 or col2=4)