Select distinct
DMA.EmpID as "Employe ID:",
DMA.LASTNAME as "Last Name:",
DMA.FirstName as "First Name:",
SM.CDU_Academic_Rank_1of2 as "CDU Rank",
DMA.AnnualPay as "Salary All:",
DMA.Class as "Emp Class",
DMA.[Department Name] as "Department:",
DMA.Activity as "Account:",
DMA.Effort_percentage/100 as "Effort",
DMA.Activitypay as "Amount",
DMA.ActivityStart as "Start Date",
DMA.ActivityEnd as "End Date",
SM.COM,
SM.COSH,
SM.SON,
KWAS.ActivityPayInactive
from
dbo.DMActivitysalary AS DMA
inner JOIN vw_KW_Shay_Main AS SM ON DMA.EmpID = SM.Employee_ID
inner join vw_KW_Activity_Salary_ODBC as KWAS on DMA.EmpID = KWAS.EmpID
where
DMA.[Department Name] in (@Dept)
AND DMA.[Effort_Percentage] in (@Effort)
AND DMA.Activity in (@Account)
AND (KWAS.ActivityPayInactive = 'NO')
AND where DMA.EmpID between DMA.ActivityStart in (@StartDate)
AND DMA.ActivityEnd in (@EndDate)
order by
DMA.ActivityEnd
您好,
我编写的报告接受了4个参数,但不确定如何在我的参数的@startdate和@enddate之间显示结果。任何帮助将不胜感激。
答案 0 :(得分:0)
首先:用单引号"
或方括号'
更改双引号[]
DMA.EmpID as "Employe ID:" --> DMA.EmpID as [Employe ID:]
然后,你的句子出错:
AND where DMA.EmpID between DMA.ActivityStart in (@StartDate)
AND DMA.ActivityEnd in (@EndDate)
用户不能两次,改变它;
AND DMA.ActivityStart >= (@StartDate)
AND DMA.ActivityEnd < (@EndDate)
注意DateTime的时间部分:
'2017-01-01 00:00:01' > '2017-01-01'