创建view,保存GROUP_CONCAT数据

create view user_account_view as
SELECT u.userId UserId ,u.userCode UserCode,GROUP_CONCAT(ac.id) AccountIdList,GROUP_CONCAT(ac.accountCode) AccountCodeList from user u LEFT JOIN accountuser acu ON u.userId = acu.userID LEFT JOIN account ac ON acu.accountID=ac.id GROUP BY u.userId ;

原文地址:https://www.cnblogs.com/a9999/p/6248724.html