如何在PostgreSQL中更新我的表ID(period_id)

时间:2019-10-15 10:10:52

标签: sql postgresql sql-update

我的表名C_InvoicePaySchedule。

|period_id | month_name |  duedate     | deff | 
----------------------------------------------
|1000463   | Aug_19     |  2019-08-02  | 1    | 
|1000464   | sep-19     |  2019-09-01  | 1    | 
|1000465   | oct-19     |  2019-10-01  | 1    | 
|1000465   | oct-19     |  2019-10-31  | 0    | 
|1000466   | nov-19     |  2019-11-30  | 1    | 
|1000533   | jun-25     | 2025-06-01   | 1    | 

我想看

|period_id | month_name | duedate     | deff | 
----------------------------------------------
|1000463   | Aug_19     | 2019-08-02  | 1    |
|1000464   | sep-19     | 2019-09-01  | 1    |
|1000465   | oct-19     | 2019-10-01  | 1    |
|1000466   | nov-19     | 2019-11-03  | 1    |
|1000467   | dec-19     | 2019-12-03  | 1    |
|1000533   | may-25     | 2025-05-03  | 1    |

如何更新period_id?

1 个答案:

答案 0 :(得分:0)

此查询

UPDATE C_InvoicePaySchedule 
  SET month_name = 'dec-19', 
      duedate  = '2019-12-03' 
WHERE period_id = '1000466;

将实现我在两个粗体行中看到的内容,希望对您有所帮助。