﻿CREATE PROCEDURE [session].[ReadSession]
	@Name [session].[SessionName]
AS
BEGIN
	SET NOCOUNT ON

	SELECT
		sess.[Name],
		BoardState,
		p1.[Name] as Player1,
		p2.[Name] as Player2
	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] = @Name;
END
