title: Using Partition and Join in MS SQL Server
body: <p>I have the following example set of data in SQL:<a href="https://i.stack.imgur.com/BzLLk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BzLLk.png" alt="enter image description here"></a></p>
  
  <p>I need to select for RequestType = 1 and ToRoleID = 1 the maximum step where there is no record with other ToRoleID.</p>
  
  <p>Example: If I filter by RequestType = 1 and ToRoleID = 1, this should give me only the row with Request_ID = 5. </p>
  
  <p>Can I do it only with partition, JOIN?</p>
  
  <p>Thank you.</p>