Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8443753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:13:25+00:00 2026-06-10T09:13:25+00:00

I searched though the internet but could not found what i was looking for,

  • 0

I searched though the internet but could not found what i was looking for, may be because i dont know what to search.

My problem is to get non-duplicate records from multiple tables…

Say if i have two tables as follows,

tableA
----------------------
code    ip
1       111.168.1.2
2       111.222.333.333
3       111.168.1.2
4       111.234.2.44
5       111.23.455.44

tableB
----------------------
code    ip                 ISP
1       111.222.333.333    newtwo
2       111.168.2.2        anon
3       111.333.453.567    def
4       111.168.2.2        tele
5       111.222.333.333    new
6       111.333.544.3      ispnew

What i expect to get out of this is,

ip
111.234.2.44
111.23.455.44
111.333.453.567
143.333.544.3

I have tried UNION, DISTICNT and DISTINCT AND UNION together like so,

SELECT DISTINCT IP FROM(SELECT IP FROM tableA UNION SELECT IP FROM tableB)

But it gives all the values unique an duplicate as follows,

ip
111168.1.2
111.222.333.333
111.234.2.44
111.23.455.44
111.168.2.2 
111.333.453.567     
111.333.544.3 

Please help me on this one, I will be much great-full..THANK YOU VERY MUCH 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T09:13:27+00:00Added an answer on June 10, 2026 at 9:13 am

    DISTINCT give every entry just once but doesn’t throw out the duplicate ones completely. what you’ll have to to is using GROUP BY, COUNT and HAVING to get rid of those:

    SELECT
      IP
    FROM
      (
        SELECT IP FROM tableA
      UNION ALL
        SELECT IP FROM tableB
      )
    GROUP BY
      IP
    HAVING
      COUNT(*) = 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I searched through here as best I could and though I found some relevant
I have searched on internet about implementation of Segment trees but found nothing when
I've searched through the internet, but haven't found any solution in c#. Does anybody
I searched through internet and this site as well but haven't found the answer.
I don't understand. I have searched all internet forums but found nothing helpful. I
I have searched through internet & found that there are no any direct method
I have searched through many times but have not seen this before. Probably really
although I searched through existing threads for my problem I havent found a solution
I've searched over this topic but found very few details which were helpful. With
I've searched the Internet for a while now and I have not been able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.