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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:09:30+00:00 2026-05-28T18:09:30+00:00

I justwant to create a query but not able to create it successfully. i

  • 0

I justwant to create a query but not able to create it successfully.
i just want to get data from two tables but not creating right query.
here is my problem.

this is my first table emp with id as a primary key
id(primary key)       name
101                   A
102                   B
103                   C
104                   D

this is my second table boss with bossid as a foreign key with emp table column id
bossid(foreign key with emp table in column id)          empid
102                                                      101
103                                                      104




now i just want to create a sql query which return me a data like this
bossid    name   empid    name
102       B      101      A
103       C      104      D


In this return query 'B' and 'C' is boss name from emp table with bossid '102','103' and 'A' and 'D' is the emp name from same table emp with empid '101','104' join with bossid from bossname table and id with empname table.

Thanks in advance.

  • 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-28T18:09:31+00:00Added an answer on May 28, 2026 at 6:09 pm

    You can use Left join or Join

    SELECT     A.bossid as bossid, B.name as name, A.empid as empid, C.name as name
    FROM       boss A
    LEFT JOIN  emp B
       ON         A.bossid = B.id
    LEFT JOIN  emp C
        ON        A.empid = C.id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just want to make a simple native query with EclipseLink, but I can't
I just want to understand why I cannot create a protected enum on C#?
I'm looking for as simple way to create an identity set. I just want
For our deployments, I just want to drop the existing stored proc, then re-create
Originally, I just want to verify that session_start locks on session. So, I create
Just want to know how to read an attribute of a parent node from
I just want a quick way (and preferably not using a while loop)of createing
Possible Duplicate: SQL Comments on Create Table on SQL Server 2008 I just want
I have two tables points and contacts and I'm trying to get the average
I want to get a distinct result based on a property, but return the

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.