I have a table articulos
-------------------------
|id|descripcion|color |
|--|-----------|--------|
|1 |caja |rojo |
|2 |baul |azul |
|3 |cofre |amarillo|
-------------------------
And another table atributos
---------------------------
|id |id_art|nombre |valor |
|---|------|-------|------|
|1 |1 |alto |150 |
|2 |1 |ancho |300 |
|3 |1 |peso |12 |
|4 |1 |stock |8 |
|5 |2 |alto |100 |
|6 |2 |ancho |200 |
|7 |2 |peso |10 |
|8 |3 |ancho |300 |
---------------------------
What I need is by means of a query of query, to obtain that the attributes of an article behave like columns to filter by the values of the same, that is to say:
-----------------------------------------------
|id|descripcion|color |alto|ancho|peso|stock|
|--|-----------|--------|----|-----|----|-----|
|1 |caja |rojo |150 |300 |12 |8 |
|2 |baul |azul |100 |200 |10 |null |
|3 |cofre |amarillo|null|300 |null|null |
-----------------------------------------------
to thus filter by them or show them.
select * from articulos where alto = 150 and ancho = 300
Thank you in advance.