我有一个SQL查询,条件为Week从星期六开始,以Friday结尾SQL查询以及该周的最后存款日期应在第一列AS [Weekending]中用作每周的预览 我尝试了以下
SELECT DISTINCT
DATEADD(DD, 7 - CHOOSE(DATEPART(dw, PostDate), 2, 3, 4, 5, 6, 7, 1), PostDate) AS WeekEndDate
FROM
[MasterReport]
WHERE
PostDate BETWEEN '12/30/2017' AND '07/1/2018'
我当前得到的输出:
但是所需的输出应如下所示:
有人可以帮忙吗?
答案 0 :(得分:1)
您需要对结果进行排序。请在下面尝试查询。
let startDate = currentSelection.startTimeHr + ":" + currentSelection.startTimeMin + " " + currentSelection.startTimeAMPM
let endDate = currentSelection.stopTimeHr + ":" + currentSelection.stopTimeMin + " " + currentSelection.stopTimeAMPM