我有一个查询,我将它作为数据表放入数据集中。查询运行良好,但是在数据表中它没有在数据列中列出任何内容,因为我无法报告它...任何想法为什么这不起作用?我的查询如下。
SELECT * FROM (
SELECT timeclock.dtTimeIn, timeclock.dtTimeOut, employees.sfirstname,
RANK() OVER ( ORDER BY dtTimeIn) rk1, --earliest record gets 1
RANK() OVER (ORDER BY dtTimeOut DESC) rk2 --latest record gets 1
FROM TimeClock INNER JOIN
Employees ON TimeClock.lEmployeeID = Employees.lEmployeeID
WHERE (dtTimeIn > dateadd(day, datediff(day, 0, getdate())-1, 0)) AND (dtTimeOut < dateadd(day, datediff(day, 0, getdate()), 0)) AND
(sDept IN ('1', '2', '3'))
) A
WHERE rk2=1
我运行查询时的当前输出:
dtTimeIn dtTimeOut sfirstname rk1 rk2
2/7/2013 2:36:00 PM 2/7/2013 7:52:33 PM Brian 10 1
在向导中创建表适配器时...我收到一条错误消息:
The Wizard detected the following problems when configuring the TableAdapter:
"OpenTime":
Details:
Generated SELECT statement.
The OVER SQL construct or statement is not supported
To add these components to your dataset, click Finish.
我猜它不喜欢查询...但我不确定除了使用“OVER”功能之外如何完成查询...