2013-08-17 55 views
0

我必須在mysql的time diff中使用一個條件。我必須修改以下查詢: -mysql timediff where條件

select 
bugs_team_user_view.bug_id, 
bugs_team_user_view.creation_ts 
from 
    bugs_team_user_view, bugs_activity 
where 
    bugs_team_user_view.team like "Red%" 
    and 

    timediff(
    (select bugs_activity.bug_when from bugs_activity where bugs_activity.added = "RESOLVED"), 
    bugs_team_user_view.creation_ts) > "00:30:00" 

    and 
    bugs_team_user_view.bug_id=bugs_activity.bug_id 
    and bugs_team_user_view.creation_ts < "2013-08-17 00:00:00" 
    and bugs_team_user_view.creation_ts >"2013-08-01 00:00:00"; 

收到錯誤: -

ERROR 1064(42000):你在你的SQL語法錯誤;請檢查與您的MySQL服務器版本相對應的手冊,以瞭解正確的語法,以便在'bugs_team_user_view.creation_ts <「2013-08-17 00:00:00」和bugs_team_user_view中使用。在1號線

請幫

+0

需要進行哪些修改? –

+0

你有什麼錯誤嗎? –

+0

是啊得到​​錯誤 – Monisha

回答

0

將其更改爲

timediff(
    (select bugs_activity.bug_when from bugs_activity where bugs_activity.added = "RESOLVED"), 
    bugs_team_user_view.creation_ts) > TIME('00:30:00') 

它應該工作。

+0

它不工作。仍然錯誤 – Monisha

+0

錯誤1064(42000) :您的SQL語法錯誤;檢查與您的MySQL服務器版本相對應的手冊,以獲得正確的語法,以便在'bugs_team_user_view.creation_ts <「2013-08-17 00:00:00」和bugs_team_user_view中使用。在第1行 – Monisha