如何在oracle中按pm(时间)过滤数据?
How to filter data by pm(time) in oracle?
我有一个 table,我在其中插入了火车号及其到达时间,现在我需要显示下午到达的火车。
我试过这个
select trainno,to_char(timeofarrival,'HH:MI:SS A.M.')"toa" from train
where to_char(timeofarrival,'HH:MI:SS A.M.')='P.M.';
因为 timeOfArrival
是一个日期
WHERE to_number( to_char( timeOfArrival, 'HH24' )) >= 12
将为您提供时间分量在中午之后的行。
我有一个 table,我在其中插入了火车号及其到达时间,现在我需要显示下午到达的火车。
我试过这个
select trainno,to_char(timeofarrival,'HH:MI:SS A.M.')"toa" from train
where to_char(timeofarrival,'HH:MI:SS A.M.')='P.M.';
因为 timeOfArrival
是一个日期
WHERE to_number( to_char( timeOfArrival, 'HH24' )) >= 12
将为您提供时间分量在中午之后的行。