title: SQL: SELECT if entry in one column corresponds to another column of a different table
body: <p>I have two tables in my database. The first one, <strong>[nodeActivity]</strong> has the following two columns ( <strong>primary Key = node_name</strong> )</p>
  
  <pre><code>node_name | last_updated |
            |              |
  node 1    |  00:00:00    |
  node 2    |  00:00:01    |
  </code></pre>
  
  <p>The second, table called <strong>[nodes]</strong> has the following columns ( <strong>no primary key</strong> )</p>
  
  <pre><code>node_name |  data   |  time     |
            |         |           | 
  node 1    |  data1  |  00:00:01 |    
  node 2    |  data2  |  00:00:01 |     
  node 1    |  data3  |  00:00:02 |    
  node 2    |  data5  |  00:00:02 |    
  node 1    |  data6  |  00:00:03 |
  node 3    |  data7  |  00:00:03 |      
  </code></pre>
  
  <p>I want to select only those nodes and data from <strong>[nodes]</strong>, which have a corresponding entry in the <strong>[nodeActivity]</strong> table.</p>
  
  <p>For example, In the above case, I want to exclude <code>node3</code> and <code>data7</code>, as node3 is not present in <strong>[nodeActivity]</strong>. 
  How can the above can be accomplished, in the most efficient manner possible?</p>