title: SQL Inner Join then left Join 3 tables
body: <p>This is using SQL Server 2012.</p>
  
  <p>I want to use inner join and left Join with 3 tables.</p>
  
  <p>Plan is: </p>
  
  <ul>
  <li>take a list of rows from table S ,</li>
  <li>corresponds to table V by s.pid=v.pid and v.pro='p' and s.reg='u' which v.categoryid=8</li>
  <li>then, there is a processed log (table L),</li>
  <li>corresponds to table V by L.pid=v.pid and L.pro=v.pro</li>
  </ul>
  
  <p>I want to find the set which is no existed in table L, means no processed before.</p>
  
  <p>I wrote:</p>
  
  <pre><code>select top 100 
      s.* 
  from   
      S
  inner join 
      V on s.pid = v.pid
  left join 
      L on L.pid = v.pid and L.pro = v.pid
  where 
      s.reg = 'u'
      and v.pro = 'p'
      and v.categoryid = 8 
      and L.pid is null
      and L.pro = 'p'
  </code></pre>
  
  <p>This returns nothing...</p>
  
  <p>Please help</p>