-1

I have two tables.

FIRST Table "Player" contains:

Player_id;
Name;
Surname;

SECOND Table "Substitutions" contains:

Sub_id;
In_player_id;
Out_player_id;

And now i want to print name and surname of in_player_id and of out_player_id using select in sql language

szufi
  • 219
  • 1
  • 2
  • 9
  • 1
    This is a pretty basic `join`, just do it to the `player` table twice. What have you tried? – sgeddes May 18 '16 at 15:16
  • Possible duplicate of [sql join two table](http://stackoverflow.com/questions/9171963/sql-join-two-table) – Halfwarr May 18 '16 at 17:16

1 Answers1

1

This can be done using two JOINs:

SELECT INPLAYER.Name, INPLAYER.Surname, OUTPLAYER.Name, OUTPLAYER.Surname
FROM Substitutions
INNER JOIN Player AS INPLAYER ON (Substitutions.In_player_id = INPLAYER.Player_id)
INNER JOIN Player AS OUTPLAYER ON (Substitutions.Out_player_id = OUTPLAYER.Player_id)

For Oracle database remove the "AS" keyword.

René Vogt
  • 43,056
  • 14
  • 77
  • 99