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

The Archive Base Latest Questions

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

Have seen multiple posts on this but I can’t see any which answer my

  • 0

Have seen multiple posts on this but I can’t see any which answer my question.

Basically I have 3 tables in my database which relate to members and their categorisation/classification.

  1. members (defines list of members and associated data)
  2. member_taxonomy (defines categories, subcategories and facilities using combination of partent id and enumerated field tax_type (CATEGORY, SUBCATEGORY, FACILITY)
  3. member_taxonomy_map (defines mapping between members and member_taxonomy)

I have a members page within which are a number of options to refine the search by specifying one or more subcategory and one or more facility. I have been trying to search on the table using the query:

SELECT members.*
FROM (members)
JOIN member_taxonomy_map ON member_taxonomy_map.member_id = members.id
WHERE member_taxonomy_map.taxonomy_id =  1
AND member_taxonomy_map.taxonomy_id =  26
AND members.active =  1
AND members.deleted =  0;

However this returns 0 rows which is something to do with having multiple where clauses on the same column but I can’t figure out how this query should look. Each time the search is refined (and there could be up to 30 different options to refine the search) I need add an additional AND clause so that only members with these mappings are returned.

An IN clause will not work as this is effectively returning any rows which match any of these particular values but this is incorrect as it needs to match exactly the values specified.

Hopefully someone can give me a few pointers in the right direction.

Thanks in advance.

UPDATE

It is possible that taxonomy_id can be 1 and 26. I prob need to include the schema for the members_taxonomy_map table.

id int
tax_name varchar
slug varchar
tax_type enum ('CATEGORY','CLASSIFICATION','FACILITY','RATING')
parent_id int
active int

Therefore any tax_type with no parent id set are top level CATEGORY. Subcategories have a parent_id CATEGORY. CLASSIFICATION’s can have a parent_id of the CATEGORY and FACILITY’s have a parent_id of CATEGORY.

Therefore for example a category could be accommodation, sub-category could be hotel and facility could be wifi. Therefore if a member has all three of these items they will have 3 entries in the mapping table. I need to be be able to filter these so that it builds up the query to filter depending on the accommodation types (i.e subcategories – those entries with a tax_type of CATEGORY but also have a parent id, then within this the classifications. The query may return multiple entries for the same member but I can deal with this by filter these out with extra SQL clauses.

  • 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-30T22:48:10+00:00Added an answer on May 30, 2026 at 10:48 pm
    SELECT members.*
    FROM (members)
    JOIN member_taxonomy_map ON member_taxonomy_map.member_id = members.id
    WHERE (member_taxonomy_map.taxonomy_id =  1
    OR member_taxonomy_map.taxonomy_id =  26)
    AND members.active =  1
    AND members.deleted =  0;
    

    It’s probably not possible for a record to have a taxonomy_id of 1 and 26; you are probably trying to get a record that contains one or the other.

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

Sidebar

Related Questions

Many posts on different aspects of this question but I haven't seen a post
Hi all I have seen all question related to this problem but couldn't find
I have seen multiple posts and websites regarding this issue, yet none of the
Many times I have seen Visual Studio solutions which have multiple projects that share
I've seen some other posts in this topic, but thought I would ask the
I've seen several other posts similar to this (namely https://stackoverflow.com/questions/5237/solutions-for-working-with-multiple-branches-in-asp-net ) but there are
This is probably a very simple and stupid question to ask, but I have
Possible Duplicate: Dynamically adding collapsible elements I've seen a few posts on this but
I have seen a few post on this, but nothing that would work entirely
The default MVVP I have seen has multiple ViewModel objects that are rendered through

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.