Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. list of unmatched countries from multiple tables using sql server

list of unmatched countries from multiple tables using sql server

Scheduled Pinned Locked Moved Database
databasesql-serversysadmin
3 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    teja murali
    wrote on last edited by
    #1

    hi Experts, im new to sqlserver,my task is...i had a two country tables(t_country and p_country).i want to list the countries which are not in p_country. thnks in advance

    M I 2 Replies Last reply
    0
    • T teja murali

      hi Experts, im new to sqlserver,my task is...i had a two country tables(t_country and p_country).i want to list the countries which are not in p_country. thnks in advance

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      Select * from tCountry where country not in (Select country from pcountry)

      1 Reply Last reply
      0
      • T teja murali

        hi Experts, im new to sqlserver,my task is...i had a two country tables(t_country and p_country).i want to list the countries which are not in p_country. thnks in advance

        I Offline
        I Offline
        i i i
        wrote on last edited by
        #3

        i will not talk about Normalization here and will post only regarding your question only try to use "NOT IN " in query select ID from T_country where id not in (select ID from P_country) if you dont have any keys then use the common fields exists in both the tables like in your case you can use Country Name but will not recommend you makes query so slow try to use any numeric fields and you can also use not equal join

        Best Of Regards, SOFTDEV Sad like books with torn pages, sad like unfinished stories ...

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups