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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:06:44+00:00 2026-06-12T07:06:44+00:00

It may be difficult to explain what I am after, apologies if the question

  • 0

It may be difficult to explain what I am after, apologies if the question is vague.

I have a table which associates products with keywords using IDs

So I may have product IDs, 2,3,4,5 associated with Keyword id 14
and product IDs 3,6,9 associated with Keyword id 15

My question is How do I count and store the total for those IDs associated with Keyword 14 and for those IDs associated with Keyword 15 and so on (New Keywords added all the time)?

MY SQL so far:

select products_keyword_categories.key_cat_name 
from products_keyword_to_product 
inner join products_keyword_categories 
on products_keyword_categories.key_cat_id = products_keyword_to_product.key_cat_id 
group by products_keyword_categories.key_cat_name

Many thanks in advance for any advice. Also, if there is any terminology that will aid me in further research via a Google search that would also be most welcome.

Edit to add: In the example above the table containing the associations is products_keyword_to_product – I inner join the other table to return the Keyword name.

Edit to add (2): Sorry I was afraid my question would be vague.
If I wanted to just count all the products using keyword ID 14 I would use COUNT() AS – As mentioned in the answers but I also need to count the number of products using Keyword ID 15 and Keyword ID 16 etc. – Hope that makes more sense.

  • 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-12T07:06:46+00:00Added an answer on June 12, 2026 at 7:06 am
    select key_cat_name ,count(*) 
    from products_keyword_categories pkc 
        inner join products_keyword_to_product ptk on pkc.id=ptk.key_id 
    group by id;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

May be a stoopid question: I have a number of reference tables in an
Is difficult to explain what I am seekig here. I have a website that
This is a difficult situation to explain, so bear with me. I have a
Alright. This may be difficult but I have been struggling for quite a bit
this may be a little difficult to explain, but I'll try. I'm creating a
First of all, my question may be unclear. I will try to explain it.
This may be difficult to explain, but here goes: I want to store 3
This may be difficult to explain. I want to specify two indexes, and then
Okay, so this one may be difficult but I will do my best to
May be I can't explain exactly in words what I am trying to achieve,

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.