非常需要专家的帮助,正如我在堆栈中建议的那样是在桌面上创建一个视图。我在这里发现了同样的问题,但其中一些仍未得到答复,有些还不清楚。我只是想为这个表创建一个表视图,我希望将ClockIn和Clock Out条目分开。我还想在我的视图中添加不同的列,例如time和time_event,其中条目与源表(ST_EmployeePunches)不同。时间的样本记录只是时间,time_event是I和O.请帮忙!
答案 0 :(得分:0)
只是为了澄清更清晰的格式,您目前拥有的是
EmployeeNumber BusinessDate ClockIn ClockOut
60616257 2012-10-01 2012-10-01 07:20:00 2012-10-01 10:49:00
你想要的是:
EmployeeNumber BusinessDate Time Time_Event
60616257 2012-10-01 2012-10-01 07:20:00 I
60616257 2012-10-01 2012-10-01 10:49:00 O
您可以使用
等查询生成此内容select EmployeeNumber, BusinessDate, ClockIn Time, 'I' Time_Event
from ST_EmployeePunches
union all
select EmployeeNumber, BusinessDate, ClockOut, 'O'
from ST_EmployeePunches