Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 6th, 2013  |  syntax: SQL  |  size: 1.69 KB  |  views: 34  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. EXPLAIN EXTENDED SELECT * FROM students ORDER BY (SELECT VALUE FROM gpas WHERE gpas.student_id = students.id LIMIT 1) DESC\G
  2. *************************** 1. ROW ***************************
  3.            id: 1
  4.   select_type: PRIMARY
  5.         TABLE: students
  6.          TYPE: ALL
  7. possible_keys: NULL
  8.           KEY: NULL
  9.       key_len: NULL
  10.           REF: NULL
  11.          ROWS: 13
  12.      filtered: 100.00
  13.         Extra: USING filesort
  14. *************************** 2. ROW ***************************
  15.            id: 2
  16.   select_type: DEPENDENT SUBQUERY
  17.         TABLE: gpas
  18.          TYPE: REF
  19. possible_keys: index_gpas_on_student_id
  20.           KEY: index_gpas_on_student_id
  21.       key_len: 5
  22.           REF: students_development.students.id
  23.          ROWS: 1
  24.      filtered: 100.00
  25.         Extra: NULL
  26. 2 ROWS IN SET, 2 warnings (0.00 sec)
  27.  
  28. SHOW WARNINGS\G
  29. *************************** 1. ROW ***************************
  30.   Level: Note
  31.    Code: 1276
  32. Message: FIELD OR reference 'students_development.students.id' OF SELECT #2 was resolved IN SELECT #1
  33. *************************** 2. ROW ***************************
  34.   Level: Note
  35.    Code: 1003
  36. Message: /* select#1 */ SELECT `students_development`.`students`.`id` AS `id`,`students_development`.`students`.`name` AS `name`,`students_development`.`students`.`email` AS `email`,`students_development`.`students`.`created_at` AS `created_at`,`students_development`.`students`.`updated_at` AS `updated_at` FROM `students_development`.`students` ORDER BY (/* select#2 */ SELECT `students_development`.`gpas`.`value` FROM `students_development`.`gpas` WHERE (`students_development`.`gpas`.`student_id` = `students_development`.`students`.`id`) LIMIT 1) DESC
  37. 2 ROWS IN SET (0.00 sec)