Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2013-03-21 : 16:36:44
|
I want to get the difference of data rows between two tables.I have table1 and table 2, both has column ACCT_UNIT.In table1, i have 170 rows and in table 2 i have 350 rows.I want to see teh difference of data between both tables.select acct_unit from table1; has 170 rowsselect acct_unit from table2; has 350 rowsThank you very much for the helpful info. |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2013-03-21 : 17:53:39
|
http://msdn.microsoft.com/en-us/library/ms188055.aspx |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-03-22 : 00:29:52
|
select acct_unit from table2EXCEPTselect acct_unit from table1; select acct_unit from table1EXCEPTselect acct_unit from table2;--Chandu |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-03-22 : 00:33:47
|
[code]select acct_unit from table2 t2WHERE NOT EXISTS (SELECT 1 FROM table1 WHERE acct_unit = t2.acct_unit )select acct_unit from table1 t1WHERE NOT EXISTS (SELECT 1 FROM table2 WHERE acct_unit = t1.acct_unit )[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2013-03-22 : 08:03:06
|
Thank you all for the helpful info. |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-03-22 : 09:38:33
|
quote: Originally posted by cplusplus Thank you all for the helpful info.
Welcome--Chandu |
|
|
|
|
|