2014-07-12 66 views
-2

我有一個問題。如何在mysql中限制搜索功能的時間

我在php中進行搜索功能。我只需要在1個小時前搜索限制。

ex。

我把「機器人」字

在結果只顯示包含機器人Openet公司在去年芒斯誰冠軍。最老的沒有表演。

謝謝

編輯

$sql = ' 
       SELECT aa_search_index.content_id, MATCH(aa_search_index.title, aa_search_index.metadata) AGAINST (?) AS score 
       FROM aa_search_index 
       LEFT JOIN aa_thread 
        ON (aa_thread.thread_id = aa_search_index.content_id) 
       WHERE MATCH(aa_search_index.title, aa_search_index.metadata) AGAINST (?) 
        AND content_type = ? 
        AND content_id != ? 

      '; 

      $params = array($query, $query, 'thread', $excludedThreadId); 
      if (!Search_query::get('options')->showResultsGlobal) 
      { 
       $params[] = $forum['node_id']; 
       $sql .= 'AND aa_thread.node_id = ? 
       '; 
      } 

      $sql .= 'LIMIT 5'; 


      $results = $this->fetchAllKeyed($sql, 'content_id', $params); 

      $threadIds = array_keys($results); 
+1

請出示你的表結構,你正在使用的查詢。 –

+0

編輯我的帖子。請幫我 – Tomy

+0

桌子結構好嗎?而'juergen d'已經給出了答案。 –

回答

1
select * from your_table 
where column_with_text = 'android' 
and datetime_column >= curdate() - interval 1 month 
+0

你可以在前。以上(在我的第一篇文章中)?我嘗試但不工作 – Tomy