時間:2024-02-07 12:09作者:下載吧人氣:21
使用函數(shù)或with實(shí)現(xiàn)
create table test(id int primary key, info text, crt_time timestamp);
with upsert as (update test set info=’test’,crt_time=now() where id=1 returning *) insert into test select 1,’test’,now() where not exists (select 1 from upsert where id=1);
網(wǎng)友評論