insert into test2 select * from test where ..............;
insert into a select * from b
简单!insert into a (字段列表) (select * from b where 条件)
之前试过cqfeng()的方法,好像mysql提示出错。 现先试试其它。
to 错误SQL 语句 : INSERT INTO staffprofile_leaved VALUES ( SELECT * FORM staffprofile WHERE staffid = '53' ) MySQL 返回:You have an error in your SQL syntax near 'SELECT * FORM staffprofile WHERE staffid = '53' )' at line 1 返回
'SELECT * FORM staffprofile WHERE staffid = '53' 应该为 'SELECT * FROM staffprofile WHERE staffid = '53'
字段及其顺序相同,用下面的写法(不加任何括号,不加values):insert into b select * form a where 条件限制;
select * from test
where ..............;
之前试过cqfeng()的方法,好像mysql提示出错。
现先试试其它。
VALUES (
SELECT * FORM staffprofile
WHERE staffid = '53'
) MySQL 返回:You have an error in your SQL syntax near 'SELECT * FORM staffprofile WHERE staffid = '53' )' at line 1
返回
'SELECT * FROM staffprofile WHERE staffid = '53'
Sorry, 各位!
一不小心写错了,感谢hnews(抓哇)。真是害死我啦,犯了这种错误。感谢各位,都有分。