我有一个包含日期的报告项目,我希望将其与今天的日期进行比较,如果它在3个月内或今天,则返回该日期或返回“是”&# 39;
有一种简单的方法可以解决这个问题吗?
答案 0 :(得分:0)
使用DateDiff
获取两个日期之间的差异
IF DATEDIFF( MONTH,@ReportDate, Getdate())<=3
BEGIN
SELECT @ReportDate as ReportDate
END
ELSE
BEGIN
SELECT "Yes"
END
答案 1 :(得分:0)
以下是您可以在查询中使用的方法:
import axios from 'axios';
export const FETCH_COMMSMATRIX = 'fetch_commsmatrix';
export function fetchCommsmatrix(id) {
const request = axios.get(`/api/user/comms/matrices/id/`+id+`/format/json?quiet=1`);
return {
type: FETCH_COMMSMATRIX,
payload: request
};
}
export const FETCH_COMMSMATRICES_BY_SERVICE = 'fetch_commsmatrices_by_service';
export function fetchCommsmatricesByService(service_id) {
const request = axios.get(`/api/user/comms/matrices/format/json?quiet=1&service_id=`+service_id);
return {
type: FETCH_COMMSMATRICES_BY_SERVICE,
payload: request
};
}
export const APPROVE_COMMSMATRIX_SOX = 'approve_commsmatrix_sox';
export function approveCommsmatrixSox(id) {
const params = 'approve=1';
const request = axios.post(`/api/admin/rename/comms/matrices/id/`+id+`/format/json?quiet=1`,params);
return {
type: APPROVE_COMMSMATRIX_SOX,
payload: request
};
}
SSRS表达式可能如下所示:
DECLARE @Date DATE = '2018-08-01'
SELECT CASE WHEN DATEADD(MONTH,3,GETDATE()) >= @Date
THEN CAST(GETDATE() AS VARCHAR) ELSE 'Yes'
END AS ColumnName
您显然会将=IIF("2018-05-01" > DATEADD(DateInterval.Month, 3, Today), "Yes", Today)
替换为您的日期字段。