create table timetable2
(
office_start_time datetime, office_end_time datetime,
first_break_start_time datetime, first__break_end_time datetime,
office_start2_time datetime, office_start2_end_time datetime,
second_break_start_time datetime,second_break_end_time datetime,
employee_od_start_time datetime,employee_od_job_time datetime
)
insert into timetable2 values
('2013-09-02 08:00:31.773','2013-09-02 12:00:31.773',
'2013-09-02 11:00:31.773','2013-09-02 11:30:31.773',
'2013-09-02 12:00:31.773','2013-09-02 18:00:31.773',
'2013-09-02 15:30:31.773','2013-09-02 16:00:31.773',
'2013-09-02 09:00:31.773','2013-09-02 10:00:31.773')
结果将是8.00,10.00,11.30,16.00
答案 0 :(得分:0)
SELECT OFFICE_START_TIME,
EMPLOYEE_OD_JOB_TIME,
FIRST__BREAK_END_TIME,
SECOND_BREAK_END_TIME
from timetable2;
<强> SAMPLE FIDDLE 强>
如果您只需要时间部分:
SELECT
cast(OFFICE_START_TIME as time) as OFFICE_START_TIME,
cast(EMPLOYEE_OD_JOB_TIME as time) as EMPLOYEE_OD_JOB_TIME,
cast(FIRST__BREAK_END_TIME as time) as FIRST__BREAK_END_TIME,
cast(SECOND_BREAK_END_TIME as time) as SECOND_BREAK_END_TIME
from timetable2;
<强> SAMPLE FIDDLE 强>
答案 1 :(得分:0)
此代码将执行.. !!
select cast(ColumnName as time) [time]
from yourtable