相关疑难解决方法(0)

如何从PostgreSql中的预约返回工作时间?

如何在PostgreSql中的预订表中找到第一个空闲时间中选择

create table reservation (during tsrange,
 EXCLUDE USING gist (during WITH &&)
 );
Run Code Online (Sandbox Code Playgroud)

用于查找从给定日期和时间开始的时间表中的差距(2012-11-17 8:下面的示例)它也发现了星期六,星期日和公众假期.公共假日在表格中定义

create table pyha ( pyha date primary key)
Run Code Online (Sandbox Code Playgroud)

如何排除周末和公众假期?

硬编码空闲时间作为保留查询之类的

with gaps as (
  select
    upper(during) as start,
    lead(lower(during),1,upper(during)) over (ORDER BY during) - upper(during) as gap
  from (
    select during
    from reservation
   union all values
     ('(,2012-11-17 8:)'::tsrange), -- given date and hour from which to find free work time
     ('[2012-11-17 0:,2012-11-18 24:)'::tsrange), -- exclude saturday
     ('[2012-11-18 0:,2012-11-19 8:)'::tsrange),  -- exclude sunday
     ('[2012-11-19 18:,2012-11-20 …
Run Code Online (Sandbox Code Playgroud)

sql postgresql planning schedule postgresql-9.2

5
推荐指数
1
解决办法
1103
查看次数

标签 统计

planning ×1

postgresql ×1

postgresql-9.2 ×1

schedule ×1

sql ×1