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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:54:17+00:00 2026-05-26T07:54:17+00:00

Please help me with this: I have a table like: id_feature id_product id_feature_value 1

  • 0

Please help me with this:
I have a table like:

id_feature  id_product  id_feature_value
1              1           50
2              1           54
5              1           67

And I want to select from this table like this:

select count(id_product) from table where (id_feature = 1 AND id_feature_value = 50) AND (id_feature = 2 AND id_feature_value = 54) AND (id_feature = 5 AND id_feature_value = 67)

my query must meet the conditions. Like having count(condition) = 3

I don’t know how to write this!

Please help me! and sorry my english!

    SELECT count( pf.id_product ) AS nr_product, value, fv.id_feature_value, filter
FROM `nk_category_features` cat_f
INNER JOIN `nk_feature_value` fv ON fv.id_feature = '11'
AND fv.value IS NOT NULL
INNER JOIN `nk_product_features` pf ON pf.id_feature = '11'
AND pf.id_feature_value = fv.id_feature_value
INNER JOIN `nk_product` p ON p.id_product = pf.id_product
AND p.product_active = '1'
INNER JOIN `nk_product_features` pf1 ON ( pf1.id_feature = '14'
AND (
pf1.id_feature_value = '21'
) )
WHERE cat_f.id_feature = '11'
AND filter >0
GROUP BY pf.id_feature, pf.id_product
ORDER BY abs( fv.value ) ASC

this is my query that i used now, but i don’t like the solution width inner join, inner join on the same 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-26T07:54:18+00:00Added an answer on May 26, 2026 at 7:54 am

    try this:

    select id_product,count(*)
    from table
    where (id_feature = 1 AND id_feature_value = 50) 
       OR (id_feature = 2 AND id_feature_value = 54) 
       OR (id_feature = 5 AND id_feature_value = 67)
    group by id_product
    having count(*) = 3
    

    To get just the total of products meeting the where clause

    select count(*)
    from 
      ( select id_product
        from table
        where (id_feature = 1 AND id_feature_value = 50) 
           OR (id_feature = 2 AND id_feature_value = 54) 
           OR (id_feature = 5 AND id_feature_value = 67)
        group by id_product
        having count(*) = 3
      ) tmp
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

please help me to parse xml from another xml... i have this xml named
may be too simple groovy question but....please help i have a list like this:
I need some help with a LINQ query in VB.Net, please. I have this
I have been frustrated by this for like a day...please help. I have an
Can anybody please help me with this as I have no idea why public
Please help me about this issue... In my application i have calender where user
can you please help me with this issue the String class does not have
Please help! I have been grappling with this error for days and I cannot
I have a long string, ex: Please help me to solve this problem. This
I cannot understand how this is possible. Please help!! I have an app with

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.