小编Ume*_*qui的帖子

T-SQL计算不同年份范围之间的持续时间(以月为单位)

我在SQL Server中有一个表,其中包含用于不同作业的用户的持续时间.我需要计算用户的总体验数.

Declare @temp table(Id int, FromDate DATETIME, ToDate DATETIME)
INSERT INTO @temp ( Id ,FromDate ,ToDate )
VALUES   ( 1 , '2003-1-08 06:55:56' , '2005-5-08 06:55:56'),
         ( 2 , '2000-10-08 06:55:56' , '2008-7-08 06:55:56'),
         ( 3 , '2013-6-08 06:55:56' , '2015-1-08 06:55:56'),
         ( 4 , '2006-4-08 06:55:56' , '2011-3-08 06:55:56' )
SELECT * FROM @temp 
Run Code Online (Sandbox Code Playgroud)

我想计算经验总数;

Id  FromDate    ToDate       Difference IN Months
===================================================
1   2003-01-08  2005-05-08    28
2   2000-10-08  2008-07-08    93
3   2013-06-08  2015-01-08    19
4   2006-04-08  2011-03-08    59 …
Run Code Online (Sandbox Code Playgroud)

sql t-sql sql-server sqldatetime sql-server-2012

9
推荐指数
1
解决办法
263
查看次数

角度错误:没有ObservableMedia的提供程序

我正在尝试使用ObservableMedia。应用程序编译成功,但是在浏览器控制台中我看到此错误

错误错误:没有ObservableMedia提供程序!在injectionError(core.es5.js:1169)处在noProviderError(core.es5.js:1207)

这是我的代码

import { Component , OnInit, ViewChild} from '@angular/core';    
    import {Observable} from 'rxjs/Rx';
    import {MediaChange, ObservableMedia} from "@angular/flex-layout";

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],

})
export class AppComponent implements OnInit {


constructor(
  public media: ObservableMedia) {

 }

  routeLinkClick() {
    if (!this.media.isActive('gt-xs')) {
      this.sidenav.toggle();
    }
  }
Run Code Online (Sandbox Code Playgroud)

请帮忙。谢谢

angular-flex-layout angular

5
推荐指数
2
解决办法
3041
查看次数