2014-07-12 34 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