2
週期數列我有這樣的表:爲每個值
Table "test_seq"
------------------------------------------------
Column | Type | Modifiers
------------------------------------------------
account_id | integer | not null
code | integer | not null
data | character varying(255) |
Indexes:
"test_seq_pkey" PRIMARY KEY, btree (account_id, code)
任務:每個「ACCOUNT_ID」可以具有「代碼」用1至3範圍內。如果下一個代碼ACCOUNT_ID是如圖4所示,數據第1行中的重寫和序列開始在週期爲1的
實施例:
account_id code data
1 1 'data 1'
1 2 'data 2'
1 3 'data 3'
1 1 'data 4' # first row destroyed
我能解決只用DB儀器這項任務?
@Dems,只插入 –
我認爲你需要在程序或應用程序邏輯中編寫代碼。 –