mysql列转行可以通过concat,先分组然后连接. show VARIABLES like '%group%' select @@group_concat_max_len SELECT GROUP_CONCAT(goods_id), as lzh FROM ts_goods WHERE ts_goods.cat_id_1 = OR ts_goods.cat_id_2 = OR ts_goods.cat_id_3 = group by lzh 这里默认的限制是1024字节,可以通过set调整一