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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:52:29+00:00 2026-05-24T05:52:29+00:00

i have the following tables in relation many-to-many: table product: prd_cod (pk) cat_cod (fk)

  • 0

i have the following tables in relation many-to-many:

table product:
prd_cod (pk)
cat_cod (fk)
prd_nome 

table description_characteristic:
prd_cod(fk)
id_characteristic(fk)
description

table characteristic:
id_characteristic(pk)
name

we suppose that the cat_cod will be 1, I would like to show data like this:

I have done this select below to solve my problem:

select p.prd_cod,p.prd_name,c.name_characteristic,dc.description
from product p,description_characteristic dc, characteristic c
where p.prd_cod = dc.prd_cod and
dc.id_ccharacteristic = c.id_characteristic and
p.cat_cod = 1

but the data were shown this way:

Prd_cod  Prd_name   name_characteristic  descript  
  1          pen        Color            pink      
  1          Pen        manufacturer     kingston  
  1          Pen        type                 brush
  1          Pen        weight               0.020

I want to show the result this way:

Prd_cod  Prd_name   name_characteristic  descript  name_characteristic  descript
  1          pen        Color            pink      type                 brush
  2          Pen-drive  manufacturer     kingston  weight               0.020

I can not do a select to solve this
please i need help
Thank you all

  • 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-24T05:52:29+00:00Added an answer on May 24, 2026 at 5:52 am
    Select VALUES YOU WANT
    FROM CATEGORIES
    LEFT JOIN product ON
    product.cat_cod=CATEGORIES.cat_cod
    LEFT JOIN description_characteristic ON
    product.prd_cod = description_characteristic.prd_cod
    LEFT JOIN characteristic ON
    description_characteristic.id_characteristic=characteristic.id_characteristic
    WHERE CATEGORIES.cat_cod = "1";
    

    You will need to put tablename.column to select fields which exist in more than one table.

    (I assumed your categories table was called CATEGORIES)

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

Sidebar

Related Questions

I have the following entity with the following relation: @Entity @Table(name = bpr_user) public
I have a product table that has a many-to-many relation to itself (using a
sql select in relation many-to-many not works as expected i have the following tables
I have following 3 tables where B, C have many to one relation ship
I have e following schema PRODUCT(ID,Name,Description) TAG(ID,Label) Product will have about 1000000 records, Tag
I have the following table, Persons_Companies , that shows a relation between persons and
Suppose that we have following tables create table Employee( 2 EMPNO NUMBER(3), 3 ENAME
I have the following tables: users +----------+----------+----------+ | id | name | dob |
I have the following tables in SQL Server 2005 ReceiptPoint: ID (PK), Name GasIndexLocation:
I'm having the following problem with 2 MySQL tables that have a relation: I

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.