我在 SSRS 中创建了一个简单的表格,左侧有员工,每列是一个数字 1 - 31。当员工预订假期时,它会使用 if 函数在他们休假的日期中放置一个 X介于日期从和日期到列之间。
这很好用,但是当该月预订了多个假期时,员工将有重复的行,而不是沿着表格中的同一行。添加组功能时,它只显示他们在当月预订的第一个假期。是否可以将所有行合二为一?
这是我的 SQL:
SELECT *
,firstname + ' ' + lastname AS 'full'
,datediff(d, holidaystart, holidayend) AS 'days'
,DAY(DATEADD(s, - 1, DATEADD(mm, DATEDIFF(m, 0, holidaystart) + 1, 0))) AS LastDay
FROM dbo.holdates
WHERE Month(holidaystart) = Param1
AND holyear = '8'
AND holidaystat = 'Approved'
AND location = ISNULL(Param2, location)
AND (holyear = @Param3 - 2005)
OR Month(holidayend) = Param1
AND (holyear = Param3 - 2005)
AND holidaystat = 'Approved'
AND location = ISNULL(Param2, location)
ORDER BY (firstname + ' ' + lastname)