add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE Games([Id] int, [Ref1] int, [Ref2] int, [Ref3] int);
INSERT INTO Games([Id], [Ref1], [Ref2], [Ref3]) VALUES
(1, 1, 3, 2),
(2, 2, 1, 3),
(3, 1, 2, 3);

CREATE TABLE Official([RefId] int, [Name] varchar(3));
INSERT INTO Official([RefId], [Name]) VALUES
(1, 'Jaz'),
(2, 'Rog'),
(3, 'Dan');
6 rows affected
SELECT g.Id,
o1.Name Name1,
o2.Name Name2,
o3.Name Name3
FROM Games g
INNER JOIN Official o1 ON g.Ref1 = o1.RefId
INNER JOIN Official o2 ON g.Ref2 = o2.RefId
INNER JOIN Official o3 ON g.Ref3 = o3.RefId
WHERE g.Id = 1
Id Name1 Name2 Name3
1 Jaz Dan Rog
SELECT g.Id,
o1.Name Name1,
o2.Name Name2,
o3.Name Name3
FROM Games g
INNER JOIN Official o1 ON g.Ref1 = o1.RefId
INNER JOIN Official o2 ON g.Ref2 = o2.RefId
INNER JOIN Official o3 ON g.Ref3 = o3.RefId
WHERE g.Id = 2
Id Name1 Name2 Name3
2 Rog Jaz Dan
SELECT g.Id,
o1.Name Name1,
o2.Name Name2,
o3.Name Name3
FROM Games g
INNER JOIN Official o1 ON g.Ref1 = o1.RefId
INNER JOIN Official o2 ON g.Ref2 = o2.RefId
INNER JOIN Official o3 ON g.Ref3 = o3.RefId
WHERE g.Id = 3
Id Name1 Name2 Name3
3 Jaz Rog Dan