CREATE PROCEDURE up_parmsel_project_details (@Project_ID INT) AS

SELECT Project_T.Project_ID, Project_Name_VC, Project_Number_VC,
	Project_Description_VC, Task_T.Task_ID, Task_Name_VC,
	Task_Relationship_T.Sub_Task_ID, Sub_Task_Name_VC

	FROM Project_T
	--
	-- Join the Task_T table to get all tasks
	--
	JOIN Task_T ON Project_T.Project_ID = Task_T.Project_ID

	--
	-- Join the Task_Relationship_T table to get all of the foreign keys for 
	-- each sub task
	--
	JOIN Task_Relationship_T ON Task_T.Task_ID = Task_Relationship_T.Task_ID

	--
	-- Join the Sub_Task_T table to get the names of the sub tasks contained
	-- in the Task_Relationship_T table
	--
	JOIN Sub_Task_T ON Task_Relationship_T.Sub_Task_ID = Sub_Task_T.Sub_Task_ID

	WHERE Project_T.Project_ID = @Project_ID

	ORDER BY Task_Relationship_T.Task_ID
