我敢肯定,下面的查詢用來爲我工作在普雷斯托:現在普雷斯托 - 靜態日期和時間戳在where子句
select segment, sum(count)
from modeling_trends
where segment='2557172' and date = '2016-06-23' and count_time between '2016-06-23 14:00:00.000' and '2016-06-23 14:59:59.000';
group by 1;
當我運行它(在普雷斯托0.147對EMR)我得到一個試圖分配VARCHAR日期/時間戳記錯誤..
我可以使它工作使用:
select segment, sum(count)
from modeling_trends
where segment='2557172' and date = cast('2016-06-23' as date) and count_time between cast('2016-06-23 14:00:00.000' as TIMESTAMP) and cast('2016-06-23 14:59:59.000' as TIMESTAMP)
group by segment;
但感覺髒兮兮 有沒有更好的方式來做到這一點?
沒了不行..現在它解釋日期作爲整數( '='不能應用於日期,整數) –