mysql - 执行此 MySQL 查询的更好方法?

标签 mysql

这就是我现在正在做的,如何在不求助于子查询且不使用 php.ini 的情况下做到这一点。我可以直接在 phpmyadmin 中运行它:

   <?php

    $query = mysql_query(" SELECT node_id FROM embeds ");
    while($row = mysql_fetch_assoc($query)) {
        $node_id = $row['node_id'];
        mysql_query(" INSERT INTO node_teaser(node_id, content) VALUES('$node_id', 'This is the teaser!') ");
    }

    ?>

最佳答案

INSERT INTO node_teaser(node_id, content)
SELECT node_id, 'This is the teaser!' FROM embeds;

关于mysql - 执行此 MySQL 查询的更好方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10542815/

相关文章:

mysql - 在其他列sql中搜索列

php - 从数据库读取 url 不起作用

mysql - ExpressJS 时间戳时区

mysql - Thinking Sphinx 中搜索条件的索引计算字段

mysql - 最适合高分榜的数据库类型

mysql - 将连续的每月潜在客户计数作为 SQL 中的列?

php - 使用 else if 处理现有电子邮件检查数据库时出错

mysql - 体育评分系统的数据库设计

mysql - 如何将 MySql 中的查询更新为我的自定义字符串

mysql - 如何在 MySQL 中存储二进制数据?