title: Sequel JOIN and WHERE
body: <p>I have the following MySQL statement:</p>
  
  <pre><code>SELECT
      a.id,
      b.category,
      b.message,
      b.is_valid
  FROM
      "NODE" a,
      "SYSTEM_STATUS" b
  WHERE 
      ("LAST_HEARTBEAT" &gt; TIMESTAMP '2017-09-18 15:10:04.471826') AND 
      a.id = b.node_id
  </code></pre>
  
  <p>I want to convert the above to Sequel</p>
  
  <p>I have this method which is a reduce version of the above MySQL statement:</p>
  
  <pre><code>0&gt; self.class.live_nodes
  
  SELECT "ID" FROM "NODE" WHERE ("LAST_HEARTBEAT" &gt; TIMESTAMP '2017-09-18 15:11:12.906017')
  
  =&gt; [#&lt;MyApp::Model::Node @values={:id=&gt;348}&gt;]
  </code></pre>
  
  <p>Now, using the results of this method, I want to do a <code>join</code> with a table called <code>system_status</code>, where the results of <code>node.id = system_status.node_id</code>. </p>
  
  <p>Next, I want to take the results of <code>live_nodes</code> and join it to <code>system_status</code> where the result is equal to <code>system_status.node_id</code>, and I am not sure how to do it.</p>
  
  <p>I tried the following: </p>
  
  <pre><code>0&gt; MyApp::Model::Node.where { last_heartbeat &gt; Time.now - HEARTBEAT_TIMEOUT.seconds }.join(:system_status, :node_id, :id)
  </code></pre>
  
  <p>But received this error</p>
  
  <pre><code>=&gt; no implicit conversion of Symbol into Integer
  </code></pre>
  
  <p>Not sure how to fix it.. I also don't think I am doing the aliasing correctly</p>