public function id($field, array $values)
    {
        $from = array();
        $where = array();
        foreach (range(1, count($values)) as $level => $num) {
            $from[] = (isset($previous)) ? "{$this->table} AS t{$num} ON t{$num}.parent = t{$previous}.{$this->id}" : "{$this->table} AS t{$num}";
            $where[] = "t{$num}.level = {$level} AND t{$num}.{$field} = ?";
            $previous = $num;
        }

        return $this->db->value("SELECT t{$num}.{$this->id} \nFROM ".implode("\n  LEFT JOIN ", $from)."\nWHERE ".implode("\n  AND ", $where), $values);
    }