﻿CREATE PROCEDURE [session].[ReadUsersBySession]
	@SessionName [session].[SessionName]
AS

SELECT
	p1.[Name] as Player1Name,
	p1.DisplayName as Player1DisplayName,
	p2.[Name] as Player2Name,
	p2.DisplayName as Player2Displayname
FROM [session].[Session] sess 
	INNER JOIN [user].[User] p1	ON sess.Player1Id = p1.Id
	LEFT JOIN [user].[User] p2 on sess.Player2Id = p2.Id
WHERE sess.[Name] = @SessionName;
