如何将单个记录从一个表复制到另一个表? [英] How to copy a single record from one table to another ?
本文介绍了如何将单个记录从一个表复制到另一个表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
mysql_query("INSERT INTO index (author,heading,description) SELECT author, heading, description FROM posts WHERE heading=".$_GET["val"]."");
此查询不起作用。
This Query is not working.
推荐答案
_GET [ val]。 );
_GET["val"]."");
此查询不起作用。
This Query is not working.
INSERT INTO FirstTable (id,name,ClassType)
SELECT id,name,ClassType FROM secondTableName
Where id = values
在sql中你可以使用如果你使用where条件获得多个记录,那么前1只获得一条记录,
In sql you can use top 1 for getting only one record if you would get more than one record s using the where condition,
INSERT INTO FirstTable (id,name,ClassType)
SELECT top 1 id,name,ClassType FROM secondTableName
Where id = values
谢谢
Bimal
Thanks
Bimal
这篇关于如何将单个记录从一个表复制到另一个表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文