如何将MySQL查询结果存储在另一个表中? [英] How to store MySQL query results in another Table?

查看:497
本文介绍了如何将MySQL查询结果存储在另一个表中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将以下查询的结果存储到另一个表中.考虑到已经创建了一个适当的表.

How to store results from following query into another table. Considering there is an appropriate table already created.

SELECT labels.label,shortabstracts.ShortAbstract,images.LinkToImage,types.Type
FROM ner.images,ner.labels,ner.shortabstracts,ner.types
WHERE
  labels.Resource=images.Resource
  AND labels.Resource=shortabstracts.Resource
  AND labels.Resource=types.Resource;

推荐答案

您可以使用INSERT INTO TABLE SELECT ....语法:

You can use the INSERT INTO TABLE SELECT....syntax:

INSERT INTO new_table_name
SELECT labels.label,shortabstracts.ShortAbstract,images.LinkToImage,types.Type 
FROM ner.images,ner.labels,ner.shortabstracts,ner.types 
WHERE labels.Resource=images.Resource AND labels.Resource=shortabstracts.Resource 
AND labels.Resource=types.Resource;

这篇关于如何将MySQL查询结果存储在另一个表中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆