protected function _subQuery($column, $bundle = null)
    {
        $alias = $this->_table->alias();
        $pk = $this->_table->primaryKey();
        $type = $this->_toolbox->getType($column);
        $subConditions = [
            'EavAttribute.table_alias' => $this->_table->table(),
            'EavValues.entity_id' => "{$alias}.{$pk}",
            'EavAttribute.name' => $column,
        ];

        if (!empty($bundle)) {
            $subConditions['EavAttribute.bundle'] = $bundle;
        }

        $subQuery = TableRegistry::get('Eav.EavValues')
            ->find()
            ->contain(['EavAttribute'])
            ->select(["EavValues.value_{$type}"])
            ->where($subConditions)
            ->sql();

        return str_replace([':c0', ':c1', ':c2', ':c3'], [
            '"' . $this->_table->table() . '"',
            "{$alias}.{$pk}",
            '"' . $column . '"',
            '"' . $bundle . '"'
        ], $subQuery);
    }