我有3张桌子:
1)participant
***********
+id_participant
+id_poste
+name
+email
2) profile_formaion
****************
+id_poste
+id_formation
3) formation
*********
+id_formation
+lable
Run Code Online (Sandbox Code Playgroud)
EXAMPLE:
数据:参与者
1 | 2 | user1 | user1@mail.com
Run Code Online (Sandbox Code Playgroud)
数据:profile_formation
2 | 3
2 | 4
Run Code Online (Sandbox Code Playgroud)
DATA:形成
1 |lable1
2 |lable2
3 |lable3
4 |lable4
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮助我如何使用sql语句(join)来获得结果:
数据:结果
1 | 2 | user1 | user1@mail.com | label3
1 | 2 | user1 | user1@mail.com | label4
Run Code Online (Sandbox Code Playgroud)
谢谢
SELECT
participant.id_participant,
participant.id_poste,
participant.name,
participant.email,
formation.lable
FROM participant
INNER JOIN profile_formaion ON
profile_formaion.id_poste = participant.id_poste
INNER JOIN formation ON
formation.id_formation = profile_formaion.id_formation
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
118 次 |
| 最近记录: |