在postgresql中,如何从同一个表中的IF column.a = 1 then column.b = foo,IF column.a = 2 then column.b = bar,IF column.a = 3 then column.b = good,IF column.a = 4 then column.b = bad 最佳答案 如果行已经存在,则不需要。你需要这样一个INSERT:UPDATE your_tableSET b = CASE WHEN a = 1 then 'foo' WHEN a = 2 then 'bar' WHEN a = 3 then 'good' ELSE 'bad' ENDWHERE some_condition = 'true';关于postgresql - 用IF语句插入INSERT INTO,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17545804/
10-15 20:44