Oracle里面SQL語句?
--兩個時間相減得到的結果是天,如果要取小時則將結果集乘24,取分再乘60,取秒再乘60.....
select to_date('2016-01-05 18:30:00','yyyy-mm-dd hh:24:mi') - to_date('2016-01-05 10:30:00','yyyy-mm-dd hh:24:mi') from dual;
select (to_date('2016-01-05 11:30:20','yyyy-mm-dd hh:24:mi') - to_date('2016-01-05 10:30:00','yyyy-mm-dd hh:24:mi'))*24*60*60 from dual;