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

  • Home
  • SEARCH
  • 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 499437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:59:07+00:00 2026-05-13T05:59:07+00:00

I have a Skills table which has 14 records in it. It is structured

  • 0

I have a Skills table which has 14 records in it. It is structured like this:
| id | name |

I then have a User_Skills table which I want to join to the skills table.
Here’s is structure:
| User_id | Skill_id |

Basically I want to be able to do a join which always results in 14 records and shows NULL in any fields the user isn’t associated with.

I almost got the result I want with this query
Code:

SELECT * FROM Skills LEFT JOIN User_Skills ON Skills.id = User_Skills.Skill_id

Edit: To make it clearer – this is the set of results with this query. I need to select the skill by the User_id, but still show all 14 skills even if the result is Null in the User_id field.

id  name    User_id     Skill_id
1   HGV1    1000    1
1   HGV1    1001    1
2   HGV2    1001    2
3   No.1 Mechanic   1000    3
3   No.1 Mechanic   1001    3
4   No.2 Mechanic   1001    4
5   Designer    1001    5
5   Designer    1000    5
6   Engineer    1000    6
7   Data Analysis   1001    7
7   Data Analysis   1000    7
8   Coaching/Inst.  1001    8
8   Coaching/Inst.  1000    8
9   Hospitality     1000    9
10  Promo Girl  1000    10
11  Public Relations    NULL    NULL
12  Photographer    NULL    NULL
13  Film Crew   1001    13
14  Physiotherapist     NULL    NULL

but it displays the amount of records I have in the user_skills table… ie, duplicate skill names because more than one user is associated with the skill.

This too, almost gets it:
Code:

SELECT * FROM Skills LEFT JOIN User_Skills ON Skills.id = User_Skills.Skill_id WHERE User_id = 1001

but this shows only the skills the user is associated with and doesn’t show any NULL entries like I want.

Does anyone know how I can achieve this query?

  • 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-13T05:59:07+00:00Added an answer on May 13, 2026 at 5:59 am
    SELECT * FROM 
    Skills LEFT OUTER JOIN 
    (select distinct user_id, skill_id from User_Skills where user_id = 1001) xxx
        ON Skills.id = xxx.Skill_id 
    

    does that produce what you need?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table Lets say TopicComments which records each comments from every user
i have 2 tables 1st table called services has id_service, name, date. description 2nd
I have a table which has been populated with incorrect data, so I need
Some development skills, like refactoring operations, feel like they have an almost unlimited pontential
Currently, i have basic C++ and PHP skills. But, i want to switch to
I have rows in an Oracle database table which should be unique for a
Currently, I have a table being read from like so: ps = con.prepareStatement(SELECT *
I have a SQL query that is returning a table like the following: id
I've always felt that my graphic design skills have lacked, but I do have
I am just starting to learn javascript, so I don't have the skills to

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.