title: Left-join Query with filter in right table for a view
body: <ul>
  <li>I need a left join query for a view
  
  <ul>
  <li>I have two filters for this view with
  parameters for the left and the right table.</li>
  <li>I need the null line from the right table.</li>
  </ul></li>
  </ul>
  
  <p>This first query didn't work, but I can filter it from a view : </p>
  
  <pre><code>select * from histoStatut h
  left join listStatut ls on h.idstatutid = ls.idstatutid or ls.idstatutid is null
  where h.idRequestid = 32651 and ls.IdListeId = 9 ;
  </code></pre>
  
  <p>This second query works but the filter on the rigth table is not acceptable for a view:</p>
  
  <pre><code>select *
  from (select * from HistoStatut)T1
  left join 
    (select h.*,ls.IdListeId from HistoStatut h
       inner join ListStatut ls on h.IdStatutId = ls.IdStatutId and ls.IdListeId = 9
    ) T2 on T1.IdHistoStatut = T2.IdHistoStatut
  where T1.IdRequestId = 32651
  </code></pre>
  
  <p><a href="http://sqlfiddle.com/#!6/88eaab/12/0" rel="nofollow noreferrer" title="Fiddle">Here, a sample on Fiddle</a></p>
  
  <p>I need a solution where I can use the two filters on a view : </p>
  
  <pre><code>CREATE VIEW AS My_Left_Join as 
    select * 
    from histoStatut h
    left join listStatut ls 
    on h.idstatutid = ls.idstatutid;
  
  Select * from My_Left_Join where IdListeId = 9 and IdRequestId = 32651
  </code></pre>
  
  <p>Expected result : <a href="https://i.stack.imgur.com/XA9JZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XA9JZ.png" alt="enter image description here"></a></p>
  
  <p>Is there a solution for a view ?</p>