title: Is it possible to execute a self join in Sequel?
body: <p>I'm working in a publications management application. By the business logic, a publication can belongs to another publication if its texts have a similarity level equal or higher than 75%. So, in the database, I created a self relation on the <code>publications</code> table.</p>
  
  <p>So far, I have the following query that works perfectly:</p>
  
  <pre><code>SELECT 
      publications.id, publications.body, 
      similar_publications.id similar_id, similar_publications.body similar_body
  FROM publications
  LEFT JOIN publications similar_publications
    ON similar_publications.id = publications.publication_id
  WHERE publications.id = &lt;an-id-here&gt;;
  </code></pre>
  
  <p>The problem is that I want to "convert" this query to Sequel's DSL, in order to simply call my model in a way like so: <code>Publication.including_similar_publications.where('publications.id = ?', 1)</code></p>
  
  <p>I know I need to create this method into my Model. My doubt is: how? Is there something similar to <code>ActiveRecord</code> named scopes in Sequel? Another problem is that because my query is a <code>SELF JOIN</code>, I need to use aliasing on <code>LEFT JOIN</code>... Does Sequel permit that I use aliases the way I exposed in my query? If yes, how? </p>