本文介绍了从两个表中查找重复的行并将其插入到临时表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Sql Server 2005

我有两个表1)ullr 2)TrnBal

具有相同的结构

表ullr中的记录
LR_否LR_日期FrmShort到Short Report_No
12345 xyz xyz xyz 11180
12346 xyz xyz xyz 11180
12347 xyz xyz xyz 11180
12348 xyz xyz xyz 11180
12349 xyz xyz xyz 11180
=====
表TrnBal中的记录
LR_否LR_日期FrmShort到Short Report_No
12345 xyz xyz xyz 11180
12346 xyz xyz xyz 11180
12347 xyz xyz xyz 11180
=====
我想从上述表格中查找重复记录
并插入到另一个临时表中

结果将是(12345/12346/12347)...

任何帮助将不胜感激..
在此先感谢
等待您的回复..... ?????

I am using Sql server 2005

I have Two Table 1) ullr 2) TrnBal

With the same structure

Records in Table ullr
LR_No LR_Date FrmShort ToShort Report_No
12345 xyz xyz xyz 11180
12346 xyz xyz xyz 11180
12347 xyz xyz xyz 11180
12348 xyz xyz xyz 11180
12349 xyz xyz xyz 11180
=====
Records in Table TrnBal
LR_No LR_Date FrmShort ToShort Report_No
12345 xyz xyz xyz 11180
12346 xyz xyz xyz 11180
12347 xyz xyz xyz 11180
=====
I want to Find Duplicate Record From the above said tables
And insert into another temp table

Result would be ( 12345 / 12346 / 12347 )...

Any Help will be highly appreciated..
Thanks in Advance
Waiting for your Reply.....?????

推荐答案

SELECT *
FROM table1 t1
INNER JOIN table2 t2 ON t1.field1 =t2.field1 AND t1.Field2 = t2.Field2...



只需将每个字段都相同的表连接在一起.



Just join the tables together where every field is the same.


这篇关于从两个表中查找重复的行并将其插入到临时表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 19:11