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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:18:20+00:00 2026-05-16T12:18:20+00:00

Ok so i have this structure PRODUCTS * PRODUCT_ID (primary key) * PRODUCT_NAME CATEGORIES

  • 0

Ok so i have this structure

PRODUCTS

* PRODUCT_ID (primary key)
* PRODUCT_NAME

CATEGORIES

* CATEGORY_ID (primary key)
* CATEGORY_NAME
* CODE

PRODUCT_CATEGORIES_MAP

* PRODUCT_ID (primary key, foreign key to PRODUCTS)
* CATEGORY_ID (primary key, foreign key to CATEGORIES)
* QUANTITY

I am using this query

SELECT * FROM `products`
where id in (
    SELECT `product_id`
    FROM `categorizations`
    WHERE category_id = (
        SELECT id
        FROM `categories`
        where code = 'something'))

this works great but i am just getting a list of products. I need the quantity of each one one in the join table

  • 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-16T12:18:21+00:00Added an answer on May 16, 2026 at 12:18 pm

    The table names in your explanation are different from your sample query. I used the ones from your query.

    SELECT p.product_id  ,
           p.product_name,
           pc.quantity
    FROM   `products` p
           JOIN `categorizations` pc
           ON     p.id = pc.`product_id`
           JOIN `categories` c
           ON     c.id = pc.category_id
    WHERE  c.code      = 'something'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is a simplified table structure: TABLE products ( product_id INT (primary key, auto_increment),
I have this table structure Product product_id (PK) name Order_Detail order_detail_id product_id quantity Example
I have an xml file that contains in products. File's structure this: <?xml version=1.0
I have 3 tables Products product_id max_products_can_sell max_products_can_sell_to_individual purchases user_id product_id quantity reservations product_id
I have this structure: Activity A has a ViewPager. The pages of a ViewPager
I have this structure on form, <input type=test value= id=username /> <span class=input-value>John Smith</span>
I have this Structure the elements of which that I need to write in
I have this structure in my html document: <p> <em>You</em> began the evening well,
I have this structure of classes: public class L3Message { public int Number {
Say i have this this structure. MyApp ├── main.py └── package ├── __init__.py ├──

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.