Tuesday, 15 February 2011

sql - I am trying to use MYSQL SELECT with many-to many relationship tables? -



sql - I am trying to use MYSQL SELECT with many-to many relationship tables? -

i have 3 tables:

students, modules , students_modules (which linking table). trying id selecting modules associated particular student. know wrong i'm trying this:

select id, name modules id = (select moduleid students_modules studentid = '123')

so 1 help me please.

use join link 3 tables each others:

select s.studentname, m.id, m.name modulename modules m inner bring together students_modules sm on m.id = sm.moduleid inner bring together students s on sm.studentid = s.id where ms.studentid = '123';

mysql sql join

No comments:

Post a Comment