Quering database

i am facing problem to fetch out records from table using Yii relationship,

i have 3 tables

  1. Students -> ID, Name, Roll_Number

  2. Subjects -> ID, Name

  3. Students_taken_Subjects -> ID, Student_ID, Subject_ID

Suppose there are number of students have taken more than one subjects which are stored in the 3rd table "Students_taken_Subjects" then how i can fetch out the list of students taken any specific subject?

e.g. list of students taken maths

which one from below relationships are correct and how can i get results into the $dataProvider variable?

'Students'=>array(self::HAS_MANY, 'Subjects', 'Student_ID'),

and

return array(


'Students'=>array(self::MANY_MANY, 'Subjects',


 'Students_taken_Subjects(student_id, subject_id)'),


);