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 |
|
MalkyTheKid
Starting Member
1 Post |
Posted - 2012-02-22 : 22:09:19
|
| Good day to all,My name is Malky, and I'm relatively new to the world of sql server scripting.I hope we could all be good friendsI have a question, is it possible to compare two identical tables and get matching records only? for example;TableA TableBField1 Field2 Field1 Field2 1 A 1 A 2 A 2 B 3 B 3 BWhat if in these two tables, I only wanted to output matching records? (I.E. my query should only return 1A and 3B)Any help would be dearly appreciated. thank you very much |
|
|
WingChunSQLGuy
Starting Member
1 Post |
Posted - 2012-02-22 : 22:55:46
|
Do a Google search for EXCEPT and INTERSECT operators. I think this might help.Salamat. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-02-22 : 23:19:31
|
[code]select *from tablea a inner join tableb bon a.field1 = b.field1and a.field2 = b.field2[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|