Duplicated id s in sql query

Asked

Viewed 45 times

1

friends have an appointment like this:

SELECT v.product_id,nome AS Produto,presentation AS Descricao, 
    presentation    AS Descricao2, name1 AS categoria, 
    description_two AS descricao, price AS preco, 
    quantity AS estoque, width, height, depth, weight, 
    NAME, referenceCode, datapostagem 
FROM Variant v 
    INNER JOIN ProductCategory p ON v.product_id = p.product_id 
    INNER JOIN Product ON Product.id = p.product_id 
    INNER JOIN Category ON Category.id = category_id 
    INNER JOIN Image i ON i.product_id = p.product_id 
    INNER JOIN DescriptionGroup D ON D.product_id = p.product_id 
    INNER JOIN Stock S ON S.variant_id = v.id 
    INNER JOIN DimensionGroup G ON G.variant_id = v.id 
LIMIT   10

and in this query return me many duplicated product_id as I can create a SUM or to separate duplicates in another table ?

  • What is the database manager? mariaDB, Oracle Database, Postgresql etc?

  • mysql, phpmyadmin

  • It is not that it is bringing duplicate, but because it can contain + of 1 record in a table referenced by JOIN, in relation to the main table Variant.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.