title: Get base url from CompleteURL using sql
body: <p>I want to get base url from CompleteURL using sql.</p>
  
  <p>Example: completeUrl: <a href="https://stackoverflow.com/questions/3075147/select-into-variable-in-mysql-declare-causes-syntax-error">SELECT INTO Variable in MySQL DECLARE causes syntax error?</a>. I want get :<a href="https://stackoverflow.com/">https://stackoverflow.com/</a></p>
  
  <pre><code>select left(CompleteURL, charindex('/', CompleteURL, charindex('://', CompleteURL ) + 3 )  - 1 )
  from urls2;
  </code></pre>