Skip to content

Commit 1d716c2

Browse files
author
P432陳啟章
committed
modify post
1 parent 1ab152a commit 1d716c2

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

source/_posts/2024-07-14-sql-impl.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,23 @@ WHERE EXISTS (SELECT 1 FROM temp_id_list t WHERE t.id = t1.id);
185185
DROP TABLE temp_id_list;
186186
```
187187

188+
# 更新並回傳更新後的數值
189+
190+
產生流水號,且每當日期欄位變動,數值會從1開始
191+
192+
```sql
193+
SELECT srl_no
194+
FROM FINAL TABLE (
195+
UPDATE table1
196+
SET
197+
srl_no = CASE
198+
WHEN date_var <> '1150326' THEN 1
199+
ELSE srl_no + 1
200+
END,
201+
date_var = '1150326'
202+
);
203+
```
204+
188205
# 修改結構
189206

190207
## 新增欄位

0 commit comments

Comments
 (0)