1

Its my query join table :

SKU | Atributes | Atributes_Value
123 | Color     | Black
123 | Size      | 40

can i modify the select query like this ? (below)

SKU | new_atributes_value
123 | Black 40

i just want to see data with same SKU in one row! i tried distinct but i didn't get the desired result (below)

SKU | Atributes | Atributes_Value
123 | Color     | Black

my question is where the size 40 ? i want to see that item with sku 123 have a black color and size 40 in one row.. anyone can help me? i need the data for my eCommerce website

Rohit Gaikwad
  • 817
  • 2
  • 8
  • 24

2 Answers2

2

You can use the group_concat in mysql:

SELECT SKU, GROUP_CONCAT(Atributes_Value SEPARATOR ' ') FROM table GROUP BY SKU;
Chief Wiggum
  • 2,784
  • 2
  • 31
  • 44
1

try this..........

SELECT sku, group_concat(Atributes_Value separator ' ') as attr_val from table_name group by sku
Rohit Gaikwad
  • 817
  • 2
  • 8
  • 24