Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Where Three columns NOT IN

$
0
0

I have a Table

1.Imp

Id    State   landuse   and few other columns

1      VA       ABC

2     VA        ABCD

3     VA       ABCD 

4     MD      XYZ

5     MD      ABCD

6    MD      ABC

7    PA     ABC

8    PA    1234

9    PA    ABCD

10   PA   ABC

7    PA     ABC

8    PA    1234

9    PA    ABCD

10   PA   ABC


2.Tblstate

  SID      StateID ,StateAbbrevation

   1000    11               DC        

   1001    12               MD

   1002    13              VA

   1003    14              PA

and so on for remaining states

3.table : land

landuse   sid

ABC         1001
ABCD     1002
XYZ         1003
1234      1004
  

I want to find if any duplicates exists in IMP table

LIKE THIS :::::

SELECT * from imp

WHERE

---combination of

LANSUSE and StateAbbreviation  NOT IN ( SELECT b.LANDUSE ,S.StateAbbreviation
from landuse b   JOIN  TblState S  ON S.Sid =b.SId  )

EX:

State landuse

PA       ABC

PA      ABC

I have to find if any state (submitted) has any repeated short names( one state can submited only with one shortnme) ,if yes how many ..

Can any one please help me on this

Thanks











                    




Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>