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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:23:02+00:00 2026-06-14T20:23:02+00:00

Hello I have a table in some cms (products) that has 3 columns: product_id

  • 0

Hello I have a table in some cms (products) that has 3 columns:

product_id feature_id value
1          1          blue
1          8          cotton
2          5          t-shirt
2          1          red
3          8          wool
1          9          large

Each product has its own id, also each product has a list of features
(about 10 of them) each feature_id represent’s a feature. Depending on
the feature_id the “value” column has the value for that type of feature.

E.x. imagine clothes, 1 unique product_id -> 1 cloth -> many features / properites like color type of material price size etc etc.

Question is it possible to fetch 3 rows something like

product_id value1 value2
1          blue   large
2          red    medium
3          green  xsmall
4          purple xlarge

where value1 is the string on the value column when products 1 feature_id = 1 and
value2 is the string on the value column when products 1 feature_id = 9 (feature_id for size)

I cant figure out how to do this in one statement, without having to merge arrays in php.

  • 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-14T20:23:03+00:00Added an answer on June 14, 2026 at 8:23 pm
    SELECT DISTINCT product_id AS book_id, (
    
    SELECT value
    FROM cscart_product_features_values
    WHERE product_id = book_id
    AND feature_id =  '1'
    ) AS publisher, (
    
    SELECT value
    FROM cscart_product_features_values
    WHERE product_id = book_id
    AND feature_id =  '8'
    ) AS author
    FROM  `cscart_product_features_values` 
    ORDER BY product_id
    

    Well after some testing this works great 🙂

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

Sidebar

Related Questions

Hello i have a products table that contains normal products and configurable product It
Hello I have a table has some info like this id | message 1
I have a table that has some content in it. Not all rows has
I have something similar to that: <table> <tr> <td>Hello,<br/>World!</td> </tr> </table> Both lines Hello,
HEllo, I have a hybrid iPhone application that has a UITabBarController and 5 Tabs.
Hello i have a JSP page that displays records from animal table in my
I have a table with some data and last column has a hyperlink for
Hello I have table in my database holding some browser information I'm currently using
I have some like that. <script src=http://code.jquery.com/jquery-latest.js></script> <table> <tr title=test id=ex1> <td><div class=move>Hello</div></td> <td>&nbsp;</td>
I have an sql table with some nvarchar columns, lets call them 'Title' and

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.