【发布时间】:2017-08-11 15:05:50
【问题描述】:
我目前正在做一个项目,我正在寻找输出,我需要计算预约和手术之间的天数,目前我有这个
Select Patient_FirstName ||' '|| Patient_surname "Patient Name", appointment_date, OPeration_date, datediff(Appointment_Date,Operation_Date) "Days till operation"
from PatientRecord p , Patient b, Appointment a, Operation o
where p.patient_ID = b.Patient_ID
and p.appointment_ID = a.appointment_ID
and p.operation_ID = o.OPeration_ID
order by Patient_Surname;
这只是返回一个无效的标识符,
当我整整几个月时它工作正常,但我需要几天
Select Patient_FirstName ||' '|| Patient_surname "Patient Name", appointment_date, OPeration_date, Round (months_between(Appointment_Date,Operation_Date)) "Days till operation"
from PatientRecord p , Patient b, Appointment a, Operation o
where p.patient_ID = b.Patient_ID
and p.appointment_ID = a.appointment_ID
and p.operation_ID = o.OPeration_ID
order by Patient_Surname;
这就是我四舍五入的时间,我可以几天做类似的事情吗?
【问题讨论】:
-
只需执行
Appointment_Date - Operation_Date即可获得天数差异。