如何将单个记录从一个表复制到另一个表?
问题描述:
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