【问题标题】:multiple updates with a select?选择多个更新?
【发布时间】:2010-10-06 06:19:48
【问题描述】:

我想写

insert into tbl1(a,b)
select 123, (select id from tbl2 where status=987)

问题是,只插入一行而不是多行。我该如何解决? 使用 Sqlite。

【问题讨论】:

    标签: sqlite bulkinsert


    【解决方案1】:

    为什么不:

    insert into tbl1(a,b)
    select 123, id
      from tbl2
     where status = 987;
    

    ?

    【讨论】:

      【解决方案2】:

      你试过了吗?

      insert into tbl1(a,b)
      select 123, x.*
        from (select id from tbl2 where status=987) x
      

      【讨论】:

      • 嵌套选择在这里没用!
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-07-19
      • 1970-01-01
      • 1970-01-01
      • 2015-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多