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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:46:25+00:00 2026-06-01T14:46:25+00:00

In SQL Server 2008 I have two tables. One table for users: id_user –

  • 0

In SQL Server 2008 I have two tables. One table for users:

id_user - integer, primary key 
id_group - integer 
username - varchar 
phone - varchar 
id_coordinating - int

Sample data:

1, 1, admin,       0230029921, NULL 
2, 2, supervisor1, 0230029933, NULL
3, 2, supervisor2, 0321211233, NULL 
4, 3, user1,       0321222323, 2 
5, 3, user2,       0323211232, 2 
6, 3, user3,       0324223121, 3

All users in group USERS have one supervisor represented by the id_user

And another table for groups

id_group - integer, primary key 
groupname - varchar 

Sample data:

1, Administrators 
2, Supervisors 
3, Users 

I’m running the the following query:

select  id_user, username,  group.groupname, phone, id_coordinating
from users  
INNER JOIN group ON users.id_group = group.id_group 

and I get the following result:

1 1 admin        Administrators 0230029921 NULL
2 2 supervisor1  Supervisors    0230029933 NULL
3 2 supervisor2  Supervisors    0321211233 NULL 
4 3 user1        Users          0321222323 2
5 3 user2        Users          0323211232 2 
6 3 user3        Users          0324223121 3

I want to replace the id_coordonating with the username and look like this…

1 1 admin        Administrators 0230029921 NULL 
2 2 supervisor1  Supervisors    0230029933 NULL 
3 2 supervisor2  Supervisors    0321211233 NULL 
4 3 user1        Users          0321222323 supervisor1  
5 3 user2        Users          0323211232 supervisor1  
6 3 user3        Users          0324223121 supervisor2 

Thanks,

  • 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-01T14:46:27+00:00Added an answer on June 1, 2026 at 2:46 pm

    You can left join back onto your users table for this.

    select
      u.id_user, 
      u.username,  
      g.groupname, 
      u.phone,
      u2.username
    from users u
    join group g
      on u.id_group = g.id_group
    left join users u2
      on u.id_coordinating = u2.id_user
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In SQL Server 2008: I have two tables, dtlScheme and dtlRenewal, with a one
I have SQL Server 2008 Ent and OLTP database with two big tables. How
In SQL Server 2008: I have one table, and I want to do something
Background information Let's say I have two database servers, both SQL Server 2008. One
I have two SQL Server 2008 Enterprise databases (on two machines), and one of
I have a SQL Server 2008 database that has two tables. These two tables
I have two tables with the exact same schema in SQL Server 2008 Standard
In SQL Server 2008, I have my parent table in one database, and the
Using SQL Server 2008 (R2). I have two tables in different databases (with same
I have two tables in the same DB on SQL Server 2008. When I

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.