我的查詢的對象是在數據庫中搜索長字符串。爲加速此過程,longstring
表的所有記錄在同一記錄上都有該字符串的散列。我想先查找表中的所有記錄,其中我的搜索字符串的哈希值等於longstring
表中的哈希值。然後,我有這個數據集後,我想比較實際的字符串(因爲散列並不總是唯一的)。'with'子句的mySQL版本
現在,Oracle或MSSQL我會做到這一點...
with dataset as (
select long_string
from longstring
where hash = 'searchhash'
) select *
from dataset
where long_string = 'searchstring'
...但MySQL不 '與' 條款的支持。那麼在mysql中我最好的選擇是什麼?
在此先感謝!
僅供參考:http://stackoverflow.com/questions/1382573/how-do-you-use-the-with-clause-in-mysql – 2009-12-14 19:37:01