创建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 ;

posted @ 2017-01-04 14:59  苍洱  阅读(187)  评论(0编辑  收藏  举报