title: Extract rows based on keys
body: <p>I have the following table:</p>
  <pre><code>key1 key2 col3 col4 col5 value
  A    B    C    D    F    good1
  F    C    C    D    F    adsf
  A    D    C    D    F    good2
  N    B    C    D    F    afd
  A    B    C    D    F    dsf
  A    D    C    D    F    fads
  </code></pre>
  <p>I am trying to extract the values from key1, and key2 columns where value includes &quot;good&quot;. Using Then I would like to extract all the rows from the table that include those keys.</p>
  <p>The expected result is:</p>
  <pre><code>key1 key2 col3 col4 col5 value
  A    B    C    D    F    good1
  A    D    C    D    F    good2
  A    B    C    D    F    dsf
  A    D    C    D    F    fads
  </code></pre>
  <p>So far, I have:</p>
  <pre><code>SELECT DISTINCT key1, key2
  FROM my_table tb1
  WHERE tb1.value LIKE '%good%'
  </code></pre>
  <p>with python pandas, I'd store the result of above and extract all the columns from <code>my_table</code>. Is there a way to do this efficiently in SQL without having to create a second table?</p>