Home  >  Article  >  Database  >  mysql insert into select

mysql insert into select

WBOY
WBOYOriginal
2016-06-06 09:37:241038browse

mysqlselect

insert into a(server_id) select server_id from b where server_id = 6 ;
a表中 设置id 为自增长
在插入的时候 有时候 select 的查询结果是空 则insert 到 a表中的数据是空 ;
有两个问题请教大家
1, 如何在 select返回结果是空的时候 给server_id赋值 ?
2 , 或者如何在select 有结果非空数据的时候插入到a表中 ?

求解救 求大腿拔毛

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn