Think\Db\Query::selectInsert PHP Method

selectInsert() public method

通过Select方式插入记录
public selectInsert ( string $fields, string $table ) : integer | string
$fields string 要插入的数据表字段名
$table string 要插入的数据表名
return integer | string
    public function selectInsert($fields, $table)
    {
        // 分析查询表达式
        $options = $this->parseExpress();
        // 生成SQL语句
        $table = $this->parseSqlTable($table);
        $sql = $this->builder()->selectInsert($fields, $table, $options);
        // 获取参数绑定
        $bind = $this->getBind();
        if ($options['fetch_sql']) {
            // 获取实际执行的SQL语句
            return $this->connection->getRealSql($sql, $bind);
        } else {
            // 执行操作
            return $this->execute($sql, $bind);
        }
    }