exists with 【查询users,其id在users1中不存在的部分】
SELECT * FROM users t WHERE NOT EXISTS (SELECT 1 FROM users1 p WHERE t.id = p.id);
指定数据库的schema
set search_path = 'test';
开窗函数
select id, deal_date, update_time from (select id, deal_date, update_time, row_number() over (partition by t.account_code,t.stock_code order by t.update_time desc) row1 from test.his_position t) a where a.row1 = 1;
指定最大的pk_ID
select setval('pk_sys_biz_date_cfg', max(id)) from test.sys_biz_date_cfg;