SQL Server Performance

SQL Script to compareof two or more tables

Discussion in 'SQL Server 2005 T-SQL Performance Tuning' started by choideyoung, Dec 10, 2007.

  1. choideyoung New Member

    I need a SQL script to compare the values in Table A with the Values in Table B. If the value in Table A is not found in Table B return the values of Table A. I'm sure there is a easy way to do this but being a novice I need some Help.
    Thanks in advance
  2. Luis Martin Moderator

  3. ranjitjain New Member

    Do You mean those records which are in table A but not in TableB, then this code should work
    SELECT t1.* FROM TableA t1 LEFT JOIN TableB t2 ON YourConditions
    WHERE t2.col IS NULL

Share This Page