将数据从一个表复制到另一个表并更改ID

时间:2018-01-31 15:07:53

标签: sql

我想将一行从一个表复制到另一个表。但在这个过程中我想要改变id的值。例如到20.怎么做?

我有这段代码

INSERT INTO work_done
SELECT * FROM work_todo
WHERE id = 10

2 个答案:

答案 0 :(得分:3)

尝试像tis这样的想法

SRA ID  ERR169499            ERR169498           ERR169497
Label   1                    0                   1
TaxID   PRJEB3251_ERR169499  PRJEB3251_ERR169499 PRJEB3251_ERR169499
333046  0.05                 0.99                99.61
1049    0.03                 2.34                34.33
337090  0.01                 9.78                23.22
99007   22.33                2.90                0.00

答案 1 :(得分:0)

 select case id
            when id = 10
              then id = 20
     into work_done
     from work_todo
    where id = 10;

OR

#include <stdio.h>

int main(void)
{
    puts("Hello World!");

    printf("You are running RIOT on a(n) %s board.\n", RIOT_BOARD);
    printf("This board features a(n) %s MCU.\n", RIOT_MCU);

    return 0;
}