get a value in a database based on select-statement <p>Sorry for my question-title, I couldn't find a better name for it.</p> <p>This is my table:</p> <pre><code>Project_ID ParentProject Projecttype ---------------------------------------- 20.003 20.001 P 20.001 20 P 20 NULL V 21.001 21 P 21 NULL V </code></pre> <p>I want to make a selection of all my projects with it's 'upperparentproject'. I want to search for all Projects with <code>Projecttype = 'P'</code> a <code>ParentProject</code> with <code>Projecttype = 'V'</code>. So this has to be my result:</p> <pre><code>Project_ID ParentProject -------------------------- 20.003 20 20.001 20 21.001 21 </code></pre> <p>Is this possible in a <code>SELECT</code> statement or is there another way to perform this? </p>