Postgres在冲突中插入SELCT
我想将其插入一个来自另一个表的表值,而无需重复。
我尝试过这种方式,但我不为我工作。 您能否帮助我找到此工作的正确查询。
insert into tab1(date_id, act_su)
(select max( valid_date ) , count(*) from table2 where status = 'ACTIVE')
ON CONFLICT (date_id)
DO NOTHING;
I would like to insert into a table values which come from another table without having duplicates.
I tried this way but i doesn't work for me..
could you please assist me to find the right query for this job.
insert into tab1(date_id, act_su)
(select max( valid_date ) , count(*) from table2 where status = 'ACTIVE')
ON CONFLICT (date_id)
DO NOTHING;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我问题的替代方法:
here is an alternative for my issue :