我有一些来自数据库的数据,但今年只有 4 个月。我希望它返回所有 12 个月。我正在使用 Sql Server Management Studio 2010。这是 sql 代码
SELECT Month = datename(month,dateadd(mm,datediff(mm,0,StartTime),0)), Count (TestName)
FROM VExecutionGlobalHistory
Where Tester <> 'dit2988'
group by
dateadd(mm,datediff(mm,0,StartTime),0), year(dateadd(mm,datediff(mm,0,StartTime),0))
order by
dateadd(mm,datediff(mm,0,StartTime),0), year(dateadd(mm,datediff(mm,0,StartTime),0))
这返回
|April|92 |
|May |79 |
|June |164 |
|July |162 |
我还想在回报中添加一些硬编码数据,并将 7 月作为最近的,所以我会有这样的东西。
|August |number|
|September|number|
|October |number|
|November |number|
|December |number|
|January |number|
|February |number|
|March |number|
|April |92 |
|May |79 |
|June |164 |
|July |162 |
所有的“数字”都是那些不是从数据库中提取的,只是我想放的东西
建议?