如果是换过来呢?如何把右边的格式转为左边的?
问题是怎么从右边转换为左边,我自己的答案是:
select user_name,(select eq_name from `test_game` b where b.user_name = a.user_name and b.equipment = 'arms' ) as arms,(select eq_name from `test_game` c where c.user_name = a.user_name and c.equipment = 'clothing' ) as clothing ,(select eq_name from `test_game` d where d.user_name = a.user_name and d.equipment = 'shoe' ) as shoe from `test_game` a group by a.user_name;
感觉子查询太多了,效率有点低,哪位大神帮忙优化一下?