Advertisement
Artur123ff2

Untitled

Mar 25th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.38 KB | None | 0 0
  1. select t.team_name, e.emp_name
  2. from teams as t
  3. join employees as e on t.team_id = e.TEAM_ID
  4. join (
  5.     select t.team_name, min(e.date_of_birth) as Birth_Date
  6.     from teams as t
  7.     join employees as e on t.team_id = e.TEAM_ID
  8.     group by t.team_id, t.team_name
  9. ) as N
  10. where t.team_name = N.team_name and e.date_of_birth = N.Birth_Date
  11. group by t.team_id, t.team_name,  e.emp_name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement