记录之间的平均间隔

时间:2016-02-22 18:42:08

标签: mysql

编辑:我有一个包含开始和结束时间字段的表。我会将公共时间间隔分组。它有可能吗?

假设此表:

time_begin time_end
07:00      18:00
09:00      12:00 (this interval is in the first line)
17:00      18:00 (this interval is in the first line)

我想回复这些话:

time_begin time_end
09:00      12:00
17:00      18:00

由于

1 个答案:

答案 0 :(得分:0)

尝试此查询。

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="example" ng-controller="exampleCtrl">
  <ng-form name="exampleForm">
    <label>Country:</label>
    <select ng-model="selectedCountry" ng-options="country as country.countryName for country in countries">
    </select>
    <label>Phone:</label>
    <input type="text" ng-model="phone" name="phone" ng-pattern="phoneNumberPattern" required>
    <small class="error" ng-show="exampleForm.phone.$error.pattern">Invalid pattern.</small>
    <small class="error" ng-show="exampleForm.phone.$error.required">Phone number is required.</small>
  </ng-form>
</div>

此查询返回第一行中时间间隔之间的所有时间间隔。