问题描述
大家好,
在Sql server 2008 r2。
我有两个相同的表no.of cols and cols名称及其数据类型。
场景
tableOne
- ----------------------------------
| col1 | col2 |日期|
| ---------------------------------- |
| A | Apple | 10/01/2014 |
| ---------------------------------- |
| B |球| 10/01/2014 |
------------------------------------
tableTwo
------------------------------------
| col1 | col2 |日期|
| ---------------------------------- |
| A | Apple | 10/02/2014 |
| ---------------------------------- |
| B |蝙蝠| 10/02/2014 |
------------------------------------
我想选择那些不匹配的记录。
例如:tableOne的行'A'是与tableTwo的行'A'匹配,
但tableOne的行'B'与tableTwo的行'B'不匹配。
我想从tableTwo中选择行'B',因为它不匹配。
上面的表格仅用于场景,实时我有1000条记录
两张桌子都是
。
任何人都可以帮助我...
谢谢
Hi guys,
In Sql server 2008 r2.
I have two table with same no.of cols and cols name and its data type.
scenario
tableOne ------------------------------------ |col1 | col2 | date | |----------------------------------| | A | Apple | 10/01/2014 | |----------------------------------| | B | Ball | 10/01/2014 | ------------------------------------ tableTwo ------------------------------------ |col1 | col2 | date | |----------------------------------| | A | Apple | 10/02/2014 | |----------------------------------| | B | Bat | 10/02/2014 | ------------------------------------
I want to select those records which are not matching.
for eg: row 'A' of tableOne is matching with row 'A' of tableTwo,
but row 'B' of tableOne is not matching with row 'B' of tableTwo.
I want to select row 'B' from tableTwo because it is not matching.
The above tables are just given for scenario, in real time i have 1000's of records
in both the tables.
Can anyone please help me...
Thanks
这篇关于如何比较sql中的cols的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!