Need help mysql joining table -


i have 4 tables , want join it

student

id   student_name   angkatan  s_1  yan            a_1 s_2  teo            a_1 s_3  mirna          a_2 

angkatan

id  angkatan   name  a_1 angkatan   1 a_2 angkatan   2 

sub

id     sub_name  payment  sub_1  bag       1000 sub_2  book      2000 

resume

id   angkatan    sub 1    a_1         sub_1 2    a_1         sub_2 3    a_2         sub_2 

from resume table want new table has result if in table resume says angkatan = ang_1 select student angkatan = ang_1 sub

nim name   angkatan  sub s_1 iyan   a_1       bag s_2 teo    a_1       bag s_1 iyan   a_1       book s_2 teo    a_1       book s_3 mirna  a_2       book 

how that? trying still couldnot found how

thanks help

based on tables , values shared above, query obtain required results angkatan = 'a_1' like

select      stu.id nim,              stu.student_name name,              stu.angkatan,              sub.sub_name sub         student stu  left join   angkatan ang on          stu.angkatan = ang.id left join   resume res on          res.angkatan = ang.id left join   sub sub on          res.sub = sub.id       res.angkatan = 'a_1' order    stu.id 

hope helps.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -