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 |
|
marcelo73
Starting Member
14 Posts |
Posted - 2006-11-22 : 16:28:14
|
| I have 2 tables A and B.I need to know what records doesn't exist at B whether in A they exist.Table A-------F1 F21 desc12 desc23 desc34 desc4Table B-------F1 F21 desc12 desc24 desc4As a result I should get:F1 F23 desc3Thanks, Marcelo. |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2006-11-22 : 16:41:23
|
| [code]select a.f1 ,a.f2from aleft outer join b on b.F1 = a.F1where b.f1 is null[/code]Be One with the OptimizerTG |
 |
|
|
vgr.raju
Yak Posting Veteran
95 Posts |
Posted - 2006-11-22 : 16:58:05
|
| If you are using sql server 2005,take a look at EXCEPT and INTERSECT Operators.Returns distinct values by comparing the results of two queries.EXCEPT returns any distinct values from the left query that are not also found on the right query.INTERSECT returns any distinct values that are returned by both the query on the left and right sides of the INTERSECT operand.The basic rules for combining the result sets of two queries that use EXCEPT or INTERSECT are the following: The number and the order of the columns must be the same in all queries. The data types must be compatible.Thanks!Rajuhttp://www.trickylife-trickylife.blogspot.com/ |
 |
|
|
|
|
|