如何在oracle sql中用下一列数据替换一列数据?
How to replace one column data with next column data in oracle sql?
我有一个 table 有 4 列,我想用第三列数据替换第二列数据?
例如
Table1
Title_ID | Title | Detail | Comments |
1 HR HR Manager NULL
2 IT IT Manager NULL
3 FIN Finance Supervisor NULL
预期输出:
表 1
Title_ID | Title | Detail | Comments |
1 HR Manager HR NULL
2 IT Manager IT NULL
3 Finance Supervisor FIN NULL
更新还是只是 select?
如果是前者,则
update table1 set
title = detail,
detail = title;
如果是后者,
select title_id,
detail as title,
title as detail,
comments
from table1
我有一个 table 有 4 列,我想用第三列数据替换第二列数据?
例如
Table1
Title_ID | Title | Detail | Comments |
1 HR HR Manager NULL
2 IT IT Manager NULL
3 FIN Finance Supervisor NULL
预期输出:
表 1
Title_ID | Title | Detail | Comments |
1 HR Manager HR NULL
2 IT Manager IT NULL
3 Finance Supervisor FIN NULL
更新还是只是 select?
如果是前者,则
update table1 set
title = detail,
detail = title;
如果是后者,
select title_id,
detail as title,
title as detail,
comments
from table1