title: How to use variables in psql LIKE query regular expression
body: <p>I have a psql database with two tables that I want to join for a query. Table 1 (we can called Articles) has two columns:</p>
  
  <ul>
  <li><p>slug - which is the name of the article path in the website</p>
  
  <ul>
  <li>example 1 - 'my-article-1' </li>
  <li>example 2 - 'my-article-2'</li>
  </ul></li>
  <li><p>title - the actual title of the article</p>
  
  <ul>
  <li>example 1 - 'My first article'</li>
  <li>example 2 - 'My second article'</li>
  </ul></li>
  </ul>
  
  <p>Table 2 (we will call Log) has two columns which together represents request responses sent back from the server:</p>
  
  <ul>
  <li><p>url - which is the url path requested by GET</p>
  
  <ul>
  <li>example 1 - '/articles/my-article1'</li>
  <li>example 2 - '/articles/my-article2'</li>
  </ul></li>
  <li><p>status - which is the status code send back from server</p>
  
  <ul>
  <li>example - '200 OK'</li>
  </ul></li>
  </ul>
  
  <p>I want to return the number of times that a specific article has been requested and returned a '200 OK' status code.</p>
  
  <p>My Problem:
  I want to match the Articles.slug variable to the Log.url variable in my where clause, but I don't know how to use variables in regular expressions. Right now I'm just working on matching the slug to the path, here is my code so far:</p>
  
  <pre><code>SELECT articles.title, articles.slug, log.path
  FROM articles, log
  WHERE log.path like '/articles/' + articles.slug
  and log.status = '200 OK'
  </code></pre>
  
  <p>I know that my WHERE clause is incorrect, that's what I'm looking for. How do I match the full log.path string to a concatenated string with a variable, articles.slug.</p>
  
  <p>Sorry if any of this is unclear or looks stupid, I'm learning SQL for the first time &lt;3</p>