sql分组和连接
Posted adstat
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql分组和连接相关的知识,希望对你有一定的参考价值。
SELECT mr.member_id, mr.username, GROUP_CONCAT(DISTINCT jb.company,jb.start_time,jb.end_time)companys, GROUP_CONCAT(DISTINCT en.school)school, CONCAT(jb.company,‘-‘,en.school) wawwa, GROUP_CONCAT(DISTINCT CONCAT(jb.company,‘ ‘,jb.start_time,‘:‘,jb.end_time)) job -- 重点 GROUP_CONCAT(DISTINCT CONCAT(en.school,‘ ‘,en.position,‘ ‘,en.start_time,‘:‘,en.end_time)) education -- 重点 FROM member mr -- 主表 RIGHT JOIN job jb ON mr.member_id = jb.member_id -- 明细 LEFT JOIN education en ON mr.education_id = en.education_id -- 明细 GROUP BY member_id
以上是关于sql分组和连接的主要内容,如果未能解决你的问题,请参考以下文章