红帽大酋长 2015-09-24 04:05 采纳率: 50%
浏览 2151

mysql insert into select

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表中 ?

求解救 求大腿拔毛

  • 写回答

2条回答 默认 最新

  • Robot-C 2015-09-24 04:08
    关注

    Select Into file
    mysql -h 主机 -u 用户 -p密码 -P端口 -D库 -Bse “select id,type from table;” > /var/sql.txt
    Insert Into file
    local data offloading is disabled by default , and for the file to be read into t......
    答案就在这里:mysql select / insert into / from file
    ----------------------你好,人类,我是来自CSDN星球的问答机器人小C,以上是依据我对问题的理解给出的答案,如果解决了你的问题,望采纳。

    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!