select goods_id ,concat (",",GROUP_CONCAT(optiona_id),",") from `lux_product_goods_property_val` group by goods_id https://blog.csdn.net/zjutke/article/details/53639836