将多行从一个表传输到另一个表
我创建了一个名为 Rate 的新表,用于对帖子表中的帖子进行评级。 Posts 表已有数据,但 Rate 为空。当我创建新帖子时,其 ID 会添加到费率中,但有许多未添加的帖子是在费率表之前发布的。
我可以使用哪种查询将多行从帖子(仅 ID)传输到费率表?
I created a new table named Rate for rating posts from my Posts table. The Posts table already has data but Rate is empty. When I create a new post, its ID is added to Rate but there are many posts not added that were published before the Rate table.
What sort of query can I use to transfer multiple rows from Posts (just the ids) to the Rate table?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 MySQL
INSERT ... SELECT
用于将数据从一个表插入到另一个表。例如:Use the MySQL
INSERT ... SELECT
for inserting data from one table to another. e.g.: