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俩字段
selectextract(day from (end-start)) * 24 + extract(hour from (end-start)) from a
原文链接:https://www.f2er.com/postgresql/193343.html