Showing posts with label sql query not having column values. Show all posts
Showing posts with label sql query not having column values. Show all posts

Friday, February 28, 2014

SQL QUERY TO FIND NOT CONTAINS VALUES

SQL QUERY - NOT CONTAINS VALUES FROM TWO TABLES  AND SAME COLUMNS

DESCRIPTION:

             In my example I have used Toad SQL Server 2008 as a query analyser.

Objective:
            To obtain the not contains value of a two tables with same column name., if table A has a column city and table B has a column city, in this scenario we need to get the cities of table A which not contains in table B.

Table "A" contains


Table "B" contains



Now I need to get the cities from table "A" which not contains in table "B"

The query is,


and we get the result as shown in below,


Thank you!