2013-02-11 116 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

相关问题