 <p>You could possibly INNER JOIN the two result sets</p> <pre><code>select from test1 AS T1 INNER JOIN (select * from test1 where head_Id_Head = 5 and detail_Id_Detail = 4) AS T2 ON T2.company_Id_Company = T1.company_Id_Company where T1.head_Id_Head = 1 and T1.detail_Id_Detail = 7 </code></pre> <p>Or even simpler</p> <pre><code>select * from test1 where head_Id_Head = 1 and detail_Id_Detail = 7 AND company_Id_Company IN (select company_Id_Company from test1 where head_Id_Head = 5 and detail_Id_Detail = 4) </code></pre>