add group by
add group by to $db->select()