mysql - Select multiple values from a column based on a certain value from another column -
i have 3 mysql tables "courses", "modules", , "course_managements" following...
"modules" table...
module_id module_title 1 accounting 2 management 3 marketing
"courses" table...
course_id course_title 1 cima 2 aat 3 slim 4 mba
"course_managements" table...
cm_id module_id course_id 1 1 1 2 1 2 3 2 1 4 2 4 5 3 3 6 3 4
i want assign sql query, selecting course id (let's '1') available module_ids have listed as... '1' , '2'
i'm trying develop interface user can select course / can view modules under it...
could suggest sql query it..?
you have take input of courseid
user , use following query modules
.
select * modules inner join course_managements on modules.module_id = course_managements.module_id course_managements.course_id = $course_id
Comments
Post a Comment