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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:47:33+00:00 2026-06-12T08:47:33+00:00

So I am trying to retrieve all interests from someone, and be able to

  • 0

So I am trying to retrieve all interests from someone, and be able to list them. This works with the following query.

SELECT *,(
    SELECT GROUP_CONCAT(interest_id SEPARATOR ",")
    FROM people_interests
    WHERE person_id = people.id
) AS interests
FROM people
WHERE id IN (
    SELECT person_id
    FROM people_interests
    WHERE interest_id = '.$site->db->clean($_POST['showinterest_id']).'
)
ORDER BY lastname, firstname

In this one which I am having trouble with, I want to select only those who happen to have their id in the table named volleyballplayers. The table just has an id, person_id, team_id, and date fields.

SELECT *,(
    SELECT GROUP_CONCAT(interest_id SEPARATOR ",")
    FROM people_interests
    WHERE person_id = people.id
) AS interests
FROM people
WHERE id IN (
    SELECT person_id
    FROM people_interests
    WHERE volleyballplayers.person_id = person_id
)
ORDER BY lastname, firstname

I just want to make sure that only the people who are in the volleyballplayers table show up, but I am getting an error saying that Unknown column 'volleyballplayers.person_id' in 'where clause' although I am quite sure of the name of table and I know the column is named person_id.

  • 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-12T08:47:34+00:00Added an answer on June 12, 2026 at 8:47 am

    Try to join it with a subquery,

    SELECT  *, GROUP_CONCAT(interest_id) interests
    FROM    people a
            INNER JOIN people_interests b
                ON b.person_id = a.id
            INNER JOIN
            (
                SELECT DISTINCT person_id
                FROM volleyballplayers
            ) c ON b.person_id = c.person_id
    GROUP BY a.id
    ORDER BY lastname, firstname
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to retrieve all the addresses from the address book and display them
I am trying to retrieve all the certificates from windows-MY, but some of them
I'm trying to build a script to retrieve all feed entries from a given
I am trying to write an SQL query to retrieve all of a users
I am trying to retrieve all cards from Mongoid that have request=preview I'm doing
I'm trying to retrieve all the data id from a database where their tags(array)
I'm using the following selector: $('#details:input[name=addr]').remove(); I'm trying to retrieve all the input fields
I'm trying to retrieve files from sharepoint via SSRS and an XML Datasource. This
I'm trying to retrieve all rows inserted during a specific month. SELECT dbo.Post.UserId, dbo.Post.Tags,
i need help with php code trying to retrieve all information from a table

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.