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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T13:27:15+00:00 2026-05-29T13:27:15+00:00

Ok, I never post on here until I’ve spent days trying to figure it

  • 0

Ok, I never post on here until I’ve spent days trying to figure it
out on my own.

This one is extremely tough. I will be very suprised and
also in awe of anyone who solves this one.

ALSO NOTE: I am doing this in PHP and don’t care how many queries or loops
I need to make to accomplish this .. so if more than one query or a php loop can
help then by all means please suggest it. Thanks

UPDATE: To simplify this, if you can solve it with availMetals like %White Gold% insetad of like %catFilter.value% I think it will be easier.

I can use PHP loops to accomplish the rest.

Thank you to anyone who takes the time to look.

I have 3 tables with the following fields:

catFilter - (id, catTypeId, value)
products - (id, availMetals)
prodFilter - (id, catFilterId, productId)

And the following Relations

products.id = prodFilter.productId
catFilter.id = prodFilter.catFilterId

I need to get three pieces of data as the
ultimate result:

catFilter.id (also could be prodFilter.catFilterId)
catFilter.value

So far I can get those two… I need the third..

A COUNT OF ..  All Products who have an availMetals like
of %White Gold% and also has catTypeId = 1

Here is What the final list would Look Like …

catFilter.value – Product Count

classic - 0
rings - 0
sets - 1
stones - 5
three - 0
halo - 3

etc.. etc…

Here is some sample data for the tables

products

id - availMetals
111 - White Gold
112 - White Gold, Yellow Gold
113 - White Gold
114 - White Gold
115 - White Gold
116 - White Gold, Platinum, Palladium


prodFilter

productId - catFilterId
111 - 43
111 - 12
111 - 48
111 - 47
112 - 12
112 - 51
112 - 48
113 - 12
113 - 51
113 - 48
114 - 12
114 - 51
114 - 48
115 - 12
115 - 48
116 - 12
116 - 51

catFilter
id - catTypeId - value
1 - 1 - Classic
50 - 1 - Rings
47 - 1 - Sets
48 - 1 - Stones
49 - 1 - Three
51 - 1 - Halo
  • 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-29T13:27:16+00:00Added an answer on May 29, 2026 at 1:27 pm

    Try something like :

    SELECT cf.id, cf.value, COUNT(p.id)
    FROM catFilter cf
    INNER JOIN prodFilter pf ON pf.catFilterId = cf.id
    INNER JOIN products p ON p.id = productId
    WHERE cf.catTypeId = 1 AND p.availMetals LIKE CONCAT('%', cf.value, '%')
    GROUP BY cf.id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a POST request, unfortunately the body of the POST never
I'm using the Post/Redirect/Get pattern on a form of mine. I've never used this
I've been running around circles the last 2 days, trying to figure a problem
There is an interesting post over here about this, in relation to cross-application flow
This has probably been asked to death around here, but I could never get
Another Internet Explorer issue! The fun never ends does it... This one is related
I have never seen the usecase for pre-increment and post-increment in actual code. The
Never used a cache like this before. The problem is that I want to
Never thought I'd have this problem :) The following snippet of code works in
Never ran into this problem with jQuery before. I have the following: $(document).ready(function() {

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.