Added joins, having, and group by to DB class. Added having to Model