Guest User

Untitled

a guest
Jul 9th, 2018
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. id | id_course | lesson_title
  2. 1 | 3 | Урок 1
  3. 2 | 3 | Урок 2
  4. 3 | 3 | Урок 3
  5. 4 | 4 | Урок 4
  6. 5 | 4 | Урок 5
  7.  
  8. id | id_lesson | email | date
  9. 43 | 1 | 123@gmail.com | 2018-07-09 13:17:05
  10. 44 | 2 | 123@gmail.com | 2018-07-09 13:18:05
  11. 45 | 3 | 123@gmail.com | 2018-07-09 13:19:05
  12.  
  13. SELECT l.id_course, h.email, MAX(h.date)
  14. FROM lesson l
  15. LEFT JOIN history h ON h.id_lesson = l.id
  16. GROUP BY l.id_course, h.email
  17. HAVING SUM(h.id_lesson IS NULL) = 0
Add Comment
Please, Sign In to add comment