给你一个问题的例子我面临创建mysql查询。使用group_concat或group by不会给我我想要的结果。
任何人都可以告诉我如何实现以下结果?如果可以使用过程或视图来解决它,那就没问题。
用户
===============
| Id | UserId |
=====+========|
| 1 | 297 |
---------------
workex
=======================================================
| wid | UserId | title | company |
=====+========+===============+=======================|
| 1 | 297 | software engineer | x |
|----+--------+---------------+-----------------------|
| 2 | 297 | sr software engineer | y |
-------------------------------------------------------
教育
=========================================================
| eid | UserId | title | institute |
=====+========+===============+=========================|
| 1 | 297 | computer science | p |
|----+--------+---------------+-------------------------|
| 2 | 297 | MS software engineering | q |
---------------------------------------------------------
结果
=====================================================================================================================================================================================
| userid | workex_title | company | workex_title | company | education | institute |education | institute |
=====+========+===============+======================================================================================================================================================|
| 297 | software engineer | x | sr software engineer | y | computer science | p |sr software engineer | q |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------