postgresql中获取两个时间类型小时差值

select extract(day from t) * 24 + extract(hour from t)   from (select  (timestamp '2013-12-14 12:00:00' - timestamp '2013-12-11 4:00:00') as t) as a;

例如a表中有start,end俩字段

select extract(day from (end-start)) * 24 + extract(hour from (end-start)) from a 

相关文章
相关标签/搜索