将行从一个表复制到另一个表,忽略重复项 [英] Copy rows from one table to another, ignoring duplicates

查看:42
本文介绍了将行从一个表复制到另一个表,忽略重复项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 2 coluom 将行从表复制到另一个表,因为两个表架构不相同,收到此错误

Im trying to copy row from table to another using 2 coluom only as the tow table schema is not identical , am getting this error

操作数应包含 1 列

任何提示我的陈述有什么问题?

Any tips whats wrong with my statement ?

 Insert table1 ( screenname,list_id )
  Select screenname,list_id
 From table2 As T1
 Where Not Exists    (
                Select 1
                From table1 As T2
                Where 
               (T2.screenname = T1.screenname,T2.list_id = T1.list_id)
                )

推荐答案

try to change where condition from (T2.screenname = T1.screenname,T2.list_id = T1.list_id) to (T2.screenname = T1.screenname AND T2.list_id = T1.list_id)

try to change where condition from (T2.screenname = T1.screenname,T2.list_id = T1.list_id) to (T2.screenname = T1.screenname AND T2.list_id = T1.list_id)

(注意 AND 关键字而不是逗号)

(note AND keyword instead of comma)

这篇关于将行从一个表复制到另一个表,忽略重复项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆