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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:16:06+00:00 2026-06-10T21:16:06+00:00

Now i JUST started getting into joins, so I’m probably missing some core understanding

  • 0

Now i JUST started getting into joins, so I’m probably missing some core understanding of it, but here’s what I want to do:

I have a table with profiles, and several tables (roles, skills, titles etc) with a profile_id, some unrelated data and a value_id (one-to-one relationship)

The user will input an array of different value_ids, and i want to retrieve the id of all profiles that has a corresponding table with a value_id matching those we retrieve from the user.

Some values in the input are specified to only match against a certain table (roles and industries in this case), and that part is working right now. However what i couldn’t do was to check if there’s a match in any of the relevant tables.


I have no idea how to style this block of sql. Sorry. Edit: It styled itself. Neat.
In this example i have three values. One (88) is specified to search for a certain role, one is for an industry (128) and the third (73) must match at least one row in a set of tables.

SELECT DISTINCT(profiles.id) as id,  
FROM profiles  
INNER JOIN profile_experience_roles r ON(r.profile_id = profiles.id)  
INNER JOIN profile_experience_industries i ON(i.profile_id = profiles.id)  
INNER JOIN profile_experience_technology t ON(t.profile_id = profiles.id)  
INNER JOIN profile_wanted_roles w ON(w.profile_id = profiles.id)  
INNER JOIN profile_languages l ON(l.profile_id = profiles.id)   
WHERE r.value_id = 88 AND i.value_id = 128 AND  
(r.value_id = 73 OR i.value_id = 73 OR t.value_id = 73 OR w.value_id = 73 OR l.value_id = 73)

The final line is what’s causing issues. Any help is appreciated.

Also, I’ve never posted here before, so I have no idea what im doing.
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-10T21:16:08+00:00Added an answer on June 10, 2026 at 9:16 pm

    Try with

    WHERE r.value_id = 88 AND i.value_id = 128 AND 
    73 IN (r.value_id, i.value_id, t.value_id, w.value_id, l.value_id)
    

    In your case, you should be able to go with

    WHERE r.value_id = 88 AND i.value_id = 128 AND 
    73 IN (t.value_id, w.value_id, l.value_id)
    

    Since r.value_id can never be 88 and 73. Same goes with i.value_id can’t be 128 and 73.

    Note that INNER JOIN demands a connection between all of these tables to fetch any rows.

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

Sidebar

Related Questions

I just started to learn about mod rewrite process. Now, I got some problems
I've just started learning Jquery but the examples aren't helping me much... Now whats
I've been stuck on this for a day now! I'm just getting started with
Basically, I've just started some development on getting a Facebook Open Graph action for
I've just started learning Python and I'm slowly getting the hang of it, but
I am just getting started with Backbone.js , but it looks really interesting... Right
Just some days ago I started looking into a unit test framework called check,
So, I'm just getting to really enjoy Core Data, and have started integrating it
I just started practicing TDD in my projects. I'm developing a project now using
I just started using virtualenv, and it was working normally until yesterday. Now, and

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.