我正在使用SQL Server,并使用内部联接或左外部联接将大约10个表联接在一起。
我的选择中有一列
vp_timesheetpunch.TIMEINSECONDS
(以秒为单位的时间)也就是以秒为单位,我想在说出小时数后再添加一列。所以它列出了秒和小时。
select
vp_timesheetpunch.personnum [Assoc ID],
vp_timesheetpunch.personfullname [Assoc Name],
vp_timesheetpunch.laborlevelname4 [Department],
vp_timesheetpunch.eventdate [Shift Date],
shiftassignmnt.shiftstartdate [Scheduled Start],
vp_timesheetpunch.startdtm [Rounded Start],
vp_timesheetpunch.inpunchdtm [Actual Start],
vp_timesheetpunch.enddtm [Rounded End],
vp_timesheetpunch.outpunchdtm [Actual End],
vp_timesheetpunch.TIMEINSECONDS [Time in seconds]
from
vp_timesheetpunch
left outer join
vp_punchexceptions on vp_timesheetpunch.timesheetitemid = vp_punchexceptions.timesheetitemid
inner join
timesheetitem on vp_timesheetpunch.timesheetitemid = timesheetitem.timesheetitemid
inner join
workedshift on timesheetitem.workedshiftid = workedshift.workedshiftid
inner join
shfasgnwshfmm on workedshift.workedshiftid = shfasgnwshfmm.workedshiftid
inner join
shiftassignmnt on shfasgnwshfmm.shiftassignid = shiftassignmnt.shiftassignid
where
--limit rows to the specified pay period
vp_timesheetpunch.eventdate = '1/22/2019'
--exclude rows that are missing data
and vp_timesheetpunch.inpunchdtm is not null
and vp_timesheetpunch.outpunchdtm is not null
--limit rows to shifts with exceptions
order by
vp_timesheetpunch.personnum,
vp_timesheetpunch.eventdate
这可以在飞行中进行吗?
我尝试添加convert并将其命名为timeinhours,但无法使convert正常工作。
数据以秒为单位列出时间,如“27900”