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 7642699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:15:23+00:00 2026-05-31T09:15:23+00:00

i have an Table called customer with columns like this CustomerID primaryCustID Phonenumber Mobilenumber

  • 0

i have an Table called customer with columns like this

 CustomerID  primaryCustID   Phonenumber  Mobilenumber
 1              1               11111       983433453
 2              2               22222       564647844
 3              3               33333       983344354
 4              4               44444       983434232
 5              2               55555       983436790
 6              4               66666       983431111
 7              4               77777       983434444
 8              8               88888       983437777
 9              3               99999       983439999

now i need to get output like this

CustomerID  primaryCustID   Phonenumber1  Mobilenumber1       Phonenumber2      Mobilenumber2
 5              2               55555       983436790           22222           564647844
 6              4               66666       983431111           44444           983434232
 7              4               77777       983434444           44444           983434232
 9              3               99999       983439999           33333           983344354

.

select e.CustomerID, m.primaryCustID ,e.Phonenumber1 "Phonenumber1", 
e.Mobilenumber "Mobilenumber1", m.Phonenumber1 "Phonenumber2",
m.Mobilenumber "Mobilenumber2" from Customer e,
Customer m where e.CustomerID<>m.primaryCustID

i tried like this but not getting excepted result

any idea how to solve this,anyhelp would be great.

Thanks

Prince

  • 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-05-31T09:15:25+00:00Added an answer on May 31, 2026 at 9:15 am

    You forgot to add the join condition that connects primaryCustID with CustomerID.

    select C1.CustomerID,
           C1.primaryCustID,
           C1.Phonenumber as Phonenumber1,
           C1.Mobilenumber as Mobilenumber1,
           C2.Phonenumber as Phonenumber2,
           C2.Mobilenumber as Mobilenumber2
    from Customer as C1
      inner join Customer as C2
        on C1.primaryCustID = C2.CustomerID
    where C1.CustomerID <> C1.primaryCustID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a table called Customer, defined like this: Id Name DepartmentId
I have a Customers table with a columns called CustomerID, CustomerNumber. I have an
Lets say I have one table called REVIEWS This table has Reviews that customers
I have a table called 'MyTable' that looks like: ID | Item | Type
I have a table called 'customer' which has too many rows & the decision
I have a table called customer which has, among others, a column called name
I need to create a new table called customer that include some of columns
I have a database called Config where I have a table called Customer In
i have table called table1 and it looks like the below record type tran_ref_number
I have a table called CUSTOMERS with 5 columns and 3 rows : LAST_NAME,

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.