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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:37:08+00:00 2026-06-15T14:37:08+00:00

Updates: It seems that solution did not fix the issue so I am trying

  • 0

Updates: It seems that solution did not fix the issue so I am trying to explain in a better way.

I am trying to implement a filter on products display, which has many custom fields and values.

E.g.

Color: Red, Blue, Green
Material: Silver, Gold, Platinum
Manufacturer: MF1, MF2, MF3

Now if someone wants to select all products with Color as Red & Blue, Material as Gold and Manufacturer as MF1, what would be the correct SQL. Please see the DB schema at Fiddle at http://www.sqlfiddle.com/#!2/6373d/2/0

I am using this query as suggested but it is not showing the correct results:

SELECT d1.productid, d1.fieldid, d1.value FROM `xcart_extra_field_values` d1 LEFT JOIN xcart_products_categories AS cat ON d1.productid = cat.productid WHERE (d1.fieldid= '36' AND d1.value LIKE '%14 karat guld%') AND cat.categoryid = '797' UNION ALL SELECT d2.productid, d2.fieldid, d2.value FROM `xcart_extra_field_values` d2 LEFT JOIN xcart_products_categories AS cat ON d2.productid = cat.productid WHERE (d2.fieldid= '37' AND d2.value LIKE '%Brillanter%') AND cat.categoryid = '797'
  • 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-15T14:37:09+00:00Added an answer on June 15, 2026 at 2:37 pm

    You did not show what the desired result of your query is but, from what I can tell your query is working but you are only showing the values that are from your table tbl_fld_val with the alias d1. If you change your query slightly, you will see that the records are present:

    SELECT d1.productid, d1.fieldid, d1.value
      ,d2.productid d2pid, d2.fieldid d2did, d2.value d2val
    FROM tbl_fld_val d1
    INNER JOIN tbl_fld_val d2 
      ON d1.productid=d2.productid
    WHERE (d1.fieldid= 36 AND d1.value LIKE '%Søl%') 
      AND (d2.fieldid= 37 AND d2.value LIKE '%Farvede%');
    

    See SQL Fiddle with Demo

    If you want the data in to appear in the same columns, then you can use a UNION ALL similar to this:

    SELECT d1.productid, d1.fieldid, d1.value
    FROM tbl_fld_val d1
    WHERE (d1.fieldid= 36 AND d1.value LIKE '%Søl%') 
    union all
    SELECT d2.productid, d2.fieldid, d2.value
    FROM tbl_fld_val d2
    WHERE (d2.fieldid= 37 AND d2.value LIKE '%Farvede%')
    

    See SQL Fiddle with Demo

    Or you can try an OR between your WHERE clauses:

    SELECT d1.productid, d1.fieldid, d1.value
    FROM tbl_fld_val d1
    INNER JOIN tbl_fld_val d2 
      ON d1.productid=d2.productid
    WHERE (d1.fieldid= 36 AND d1.value LIKE '%Søl%') 
      OR (d2.fieldid= 37 AND d2.value LIKE '%Farvede%');
    

    See SQL Fiddle with Demo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It seems that in a standard Xcode project, the default target automatically updates the
-----UPDATE----- Well, seems that the problem was in last.id . When database is created
I want to update fontconfig to a newer version but it seems that the
Update Solution Found See Bottom of post if interested Seems simple enough and for
I am facing an issue with SecureRandom in java. This was the code that
I'm trying to build a small VS 2005 solution I've just checked out of
I've got a navigationBar that does not auto-resize when rotating the device anymore. So
We have some HTML pages (local, not on a web server) that use the
UPDATE: Seems to me like it is pretty much an Apple bug. I tried
Update : The error seems to be generated by this line: *line = color;

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.