There are several tables in the database:

  • katalog - product catalog
  • groups - groups to which the product belongs
  • color - here are presented all kinds of colors with their id
  • colors_t - colors are assigned to the goods, i.e. product id-> color id from colosr table

It is necessary to make a request to select all items from the katalog table with their parameters, group and colors and export to Excel. I compiled the request myself using the JOIN, everything that needs to be pulled out is good, but there is one thing, one product can have several colors, and for this reason the resulting table is of the form:

  • Name-group-color
  • The same product name-group-other color

How to make a union or sorting to be: the name-group-all the colors of this product.

    1 answer 1

    and can make 2 requests 1) all about the product except the color 2) all the colors of the product (loop)

    then combine the received?

    • It is possible and so, there were such thoughts, I decided to consult just in case, all of a sudden there would be some suggestions) - shanhaichik
    • Well, why reinvent the wheel? Screw complex SQL query. - KoVaLsKy