Guest User

Untitled

a guest
Nov 29th, 2014
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.10 KB | None | 0 0
  1. SELECT 
  2.      schedule.student_id
  3.      , schedule.`day`
  4.      , tfirst.subjects
  5.      , tsecond.subjects
  6.      , tthird.subjects
  7.      , tfourth.subjects
  8.      , tfifth.subjects
  9.      , tsixth.subjects
  10.      , tseventh.subjects
  11.      , teighth.subjects
  12.      , tninth.subjects
  13.      , ttenth.subjects
  14.   FROM schedule
  15.      LEFT JOIN subjects tfirst ON tfirst.subject_id = schedule.`first`
  16.      LEFT JOIN subjects tsecond ON tsecond.subject_id = schedule.`second`
  17.      LEFT JOIN subjects tthird ON tthird.subject_id = schedule.third
  18.      LEFT JOIN subjects tfourth ON tfourth.subject_id = schedule.fourth
  19.      LEFT JOIN subjects tfifth ON tfifth.subject_id = schedule.fifth
  20.      LEFT JOIN subjects tsixth ON tsixth.subject_id = schedule.sixth
  21.      LEFT JOIN subjects tseventh ON tseventh.subject_id = schedule.seventh
  22.      LEFT JOIN subjects teighth ON teighth.subject_id = schedule.eighth
  23.      LEFT JOIN subjects tninth ON tninth.subject_id = schedule.ninth
  24.      LEFT JOIN subjects ttenth ON ttenth.subject_id = schedule.tenth
  25. WHERE
  26.      schedule.student_id = '$id'
Advertisement
Add Comment
Please, Sign In to add comment