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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:51:07+00:00 2026-06-09T15:51:07+00:00

I have a table with products related to an idpage like this: +——–+———–+————-+————-+ |

  • 0

I have a table with products related to an idpage like this:

+--------+-----------+-------------+-------------+
| idPage | idProduct | inputedName | inputedCode |
+--------+-----------+-------------+-------------+
|     25 |        60 | x           | 8924        |
|     26 |        65 | y           | 105555      |
|     26 |        70 | z           | 105555      |
|     27 |        33 | a           | 14151112    |
|     27 |        34 | a           | 14151112    |
|     27 |        22 | a           | 14151112    |
|     27 |        17 | b           | OS987456    |
|     27 |        18 | c           |             |
|     27 |        17 |             |             |
|     27 |        23 | a           | 14151112    |
+--------+-----------+-------------+-------------+

There is no id Unique.

The user input InputedName and InputedCode on a form.

What I want to do on page view is select DISTINCT combination of InputedName x Inputed Code and intersect or inner join (or whatever) with all related itens to show something like:

In idPage=27:
- a 141511112 (inputedName, inputedCode)
-- 33 (idProduct)
-- 34
-- 22
-- 23
- b OS987456
-- 17        
- c (null)
-- 18
- (null)(null)
-- 17

Is there a great way to do that or the basic way is the best? Basic way, I mean, I’m using PHP. I would first select Distinct combination of inputedName with inputedCode (I still don’t know how to do it with my table) and into while command of PHP I would do another query. In this case it would do 5 queries. I don’t think it is a ellegant solution, but as I know mysql is powerful, maybe there is another way.

  • 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-09T15:51:09+00:00Added an answer on June 9, 2026 at 3:51 pm

    I’m confused of what you are asking for but let me give this a try:

    SELECT  inputedName, inputedCode, GROUP_CONCAT(idProduct)
    FROM    sampleTable
    WHERE   idPage = 27
    GROUP BY inputedName, inputedCode
    order by COALESCE(inputedname, 'z'),   -- this part is optional
             COALESCE(inputedCode, 'z')    -- this part is optional
    

    SQLFiddle Demo (Click Here)

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

Sidebar

Related Questions

I have two models, say Product and Bundle. products table is related to product_prices
I have a table products , and I have columns like product_name , product_id
I have a DB structured like this: CATEGORIES > SUBCATEGORIES > PRODUCTS In just
I have three tables in php-mysql products,product_fact,fact schema is like this products id ,
I am tying to make a table for related products so products will have
I have this table, -------------------------------------------- | products_id | related_products_ids | | ----------------------------------------- | 1
I have table 'products' and I need to update 'price' field by 20% if
I have a table of products sales that may look as follows: product |
I have a table of products, and I need to write an SQL query
I have a table called Products in my database. It has a couple of

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.