Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两列,比如“2010-10-26”和“2010-08-23”,我想以天为单位获取间隔,考虑到有有 30、31、29、28 天的月份?是否有任何功能已经做到了这一点?
谢谢你。
如果它们已经是日期格式,那很容易:
SELECT '10/26/2010'::date - '08/23/2010'::date;
或者:
SELECT date '2001-10-01' - date '2001-09-28'; // outputs integer 3