无法使用“选择为" MySql中的语句 [英] Cannot use "select into" statement in MySql
本文介绍了无法使用“选择为" MySql中的语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好!
我是MySql的新手,但我对SQL Server很熟悉.
我的MySql有问题.
我想从表中选择记录,然后插入到新表或临时表中.
在SQL Server中
从ExistingTable中选择*进入NewTable
或从ExistingTable中将*选择到#TmpTable
如何在MySql中遵循这些?
Hi every one!
I am new with MySql, but I am familiar with SQL Server.
I have a problem with MySql.
I want to select records from a table and insert into a new or temporary table.
In SQL Server
select * into NewTable from ExistingTable
or select * into #TmpTable from ExistingTable
How to follow these in MySql?
Thanks!
推荐答案
在MySQL中,您可以按以下方式使用SELECT:
SELECT field1,field2 INTO var1,var2 FROM table1 LIMIT 1;
这将使我们能够将选定的列直接存储到变量中.
http://dev.mysql.com/doc/refman/5.0/en/select-into-statement.html [ ^ ]
您应该先创建一个临时表,然后使用
插入temp_table ...从表中选择*.示例参考:
http://www.tutorialspoint.com/mysql/mysql-temporary-tables.htm [ ^ ]
In MySQL, you can use SELECT into as follows:
SELECT field1, field2 INTO var1,var2 FROM table1 LIMIT 1;
This will allow us to store the selected columns directly into variables.
http://dev.mysql.com/doc/refman/5.0/en/select-into-statement.html[^]
You should create a temp table first and then use
insert into temp_table ... select * from table.. example reference:
http://www.tutorialspoint.com/mysql/mysql-temporary-tables.htm[^]
这篇关于无法使用“选择为" MySql中的语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文