protected function getWhere(array $queryParts)
    {
        if (!isset($queryParts['where']) || empty($queryParts['where'])) {
            return null;
        }

        $where = array();
        foreach ($queryParts['where'] as $w) {
            $where[] = $this->formatWhere($w);
        }

        return 'WHERE ' . implode(' AND ', $where);
    }