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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:37:13+00:00 2026-05-25T12:37:13+00:00

I have a table vm_category in which I fetch all rows from the category_id

  • 0

I have a table vm_category in which I fetch all rows from the category_id and caregory_name columns. I then use this in a drop-down to populate a search-filter module on the left side of the side.

Now doing so gives me a gigantic list of categories, and I’d like to narrow it down by category’s sub-category. Those are organized in another table called vm_category_xref in which I have 3 columns;

  • category_parent_id
  • category_child_id
  • category_list

What I’d like to do is specify in my query to only return the category_id and names that match a specific category_parent_id in the _xref table. Here is my current query:

$query = "SELECT `c`.`category_name` AS `name` , `c`.`category_id` AS `id`
          FROM `#__vm_category` AS `c` ORDER BY `c`.`category_id`;";

I am not familiar with JOIN enough to figure this out, but I know it should be rather simple, and any help would be much appreciated. Thank you!

  • 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-25T12:37:14+00:00Added an answer on May 25, 2026 at 12:37 pm

    Try this:

    SELECT 
        c.category_name AS name, 
        c.category_id AS id
    FROM #__vm_category AS c 
        INNER JOIN vm_category_xref xr
        ON xr.category_child_id = c.category_id
    WHERE xr.category_parent_id = 5 /* the parent_id you want to filter on */
    ORDER BY c.category_id;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with 6 columns in it, I'm trying to fetch all
I have table rows of data in html being filled from a CGI application.
I have table of 5000+ rows and 8+ columns like, Station Lat Long Date
I have table with few rows, after use hover mouse over row I want
I have table inside a div tab. The table has 40 rows in it
I have table with some fields that the value will be 1 0. This
I have table with 3 columns A B C. I want to select *
I have table in data base name train delay, with columns train number(int), DelayTime(int),
I am wonder about how to update the table. I have use below two
I am inserting rows into a table from a Powershell script. I loop 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.