title: SQL retrieve columns based on two rows values conditions
body: <p>I have a table called <code>products</code></p>
  <pre><code>    id | product_id     | detail       | value
     ----+----------------+--------------+--------
     1   | 1              | size         | medium
     2   | 1              | load         | yes
     5   | 1              | color        | green
     3   | 1              | availability | 10
     4   | 1              | deliverable  | yes
     5   | 2              | size         | small
     6   | 2              | load         | no
     7   | 2              | color        | bleu
     8   | 2              | availability | 5
     9   | 2              | deliverable  | yes
  </code></pre>
  <p>I need to develop a query where I can extract rows based on a condition.</p>
  <ul>
  <li>I want to select  id, product_id, detail,value</li>
  </ul>
  <ul>
  <li><p>if  detail=&quot;load&quot; and value=&quot;yes&quot; then select * execept  detail=&quot;delivrable&quot; and I do not care its value</p>
  </li>
  <li><p>if  detail=&quot;load&quot; and value=&quot;no&quot; then  select * execept  detail=&quot;load&quot; and I do not care its value
  =&gt; I need only 1 detail between load and deliverable based on the values detail=&quot;load&quot; and value=&quot;yes&quot; as shown in the wished outcomes table below</p>
  <pre><code> id  | product_id     | detail       | value
   ----+----------------+--------------+-------
   1   | 1              | size         | medium
   2   | 1              | load         | yes
   5   | 1              | color        | green
   3   | 1              | availability | 10
   5   | 2              | size         | small
   7   | 2              | color        | bleu
   8   | 2              | availability | 5
   9   | 2              | deliverable  | yes
  </code></pre>
  </li>
  </ul>
  <p>Thank you in advance for your help</p>