2013-02-11 173 views
0

我對Postgres的濾波之間有兩個上午下午的時間在

AND to_char(eat.datecreated, 'HH12:MI:SS AM') BETWEEN 
    to_char('06:00:00', 'HH12:MI:SS AM') AND to_char('06:00:00', 'HH12:MI:SS AM') 

的過濾器,並導致:

ERROR: function to_char(unknown, unknown) is not unique 
LINE 25: ...to_char(eat.datecreated, 'HH12:MI:SS AM') BETWEEN to_char('0... 
                 ^
HINT: Could not choose a best candidate function. You might need to add explicit type casts. 

********** Error ********** 

ERROR: function to_char(unknown, unknown) is not unique 
SQL state: 42725 
Hint: Could not choose a best candidate function. You might need to add explicit type casts. 
Character: 1455 

請幫助我。我堅持這個查詢。

+0

請注意,對於timestamptz,演員會根據您當地的時區返回時間。這可能是也可能不是你想要的。你將不得不定義你的需求和使用的確切數據類型。 – 2013-02-11 13:48:25

回答

1
and eat.datecreated::time between '06:00:00'::time and '18:00:00'::time 
+0

非常感謝我解決了我的問題! – 2013-02-11 09:04:18

相關問題