title: SQL multiple left join in subquery?
body: <p>Any idea on how to resolve this query dependency issue? Would subquery help? Database I'm using is sql server 2012.</p>
  
  <pre><code>FROM [Scheduling].[studentsection] AS [table027]  
  
  Left JOIN [Grading].[StudentGradeBucket] AS [table028]
  ON ([table028].[StudentSectionID] = [table027].[StudentSectionID])
      And (@0 = [table002].[label]) 
  
  Left JOIN [Grading].[GradingPeriodGradeBucket] AS [table029]
  ON [table028].[GradingPeriodGradeBucketID] = [table029].[GradingPeriodGradeBucketID] 
  
  Left JOIN [Grading].[GradeBucket] AS [table002]  
  ON [table029].[GradeBucketID] = [table002].[GradeBucketID] 
  
  Left JOIN [Grading].[GradeBucketType] AS [table001]  
  ON [table002].[GradeBucketTypeID] = [table001].[GradeBucketTypeID] 
  
  Left JOIN [Grading].[GradeMark] AS [table022]  
  ON [table028].[GradeMarkID] = [table022].[GradeMarkID] 
  </code></pre>
  
  <p>The dependency issue I have is with this:</p>
  
  <pre><code>@0 = [table002].[label] //@0 is a string variable
  </code></pre>
  
  <p>Like the join hasn't been created yet but I need to use it to create the join for relationship [Grading].[StudentGradeBucket] or [table028]</p>