title: mySQL version of 'with' clause
body: <p>The object of my query is to search for a long string in a database. To speed up this process, all records of the <code>longstring</code> table have a hash of that string on the same record. I want to first find all records in the table where my search string's hash is equal to a hash on the <code>longstring</code> table. Then after I have that dataset, I want to compare the actual strings (since hashes aren't always unique).</p>
  
  <p>Now in oracle or mssql I would do this...</p>
  
  <pre><code>with dataset as (
    select long_string
    from longstring
    where hash = 'searchhash'
  ) select *
  from dataset
  where long_string = 'searchstring'
  </code></pre>
  
  <p>... but mysql doesn't support 'with' clauses. So what is my best alternative in mysql?</p>
  
  <p>Thanks in advance!</p>