Sample output: Rise_ID FROM_LOCATION TO_LOCATION SEATS_LEFT SEATS_TOTAL RIDE_PROVIDER START_ON ENDS _ON IS_STARTED IS_FINISHED 12014 Nandi hills banglore 0 3 11002 13-Nov-20 04.00.13.36 PM. 13-Dec-20 08.02.13.36PM yes yes
CodePudding user response:
one way you can get the difference between the 2 date columns as follows. If the following SQL SYSDATE is getting the current time, the other column is a hard coded date time column.
SELECT ROUND(minutes_ / 60, 2) || ' Hours '
FROM ( SELECT (sysdate - to_date('14/09/2022 19:35:00', 'DD/MM/YYYY HH24:MI:SS')) * 24 * 60 AS minutes_
FROM dual
);
CodePudding user response:
SELECT FROM_LOCATION || ' - ' || TO_LOCATION FROM TABLE_OUTPUT T WHERE (TO_DATE(START_ON, 'DD-MON-YY HH.MI.SS') - TO_DATE(ENDS_ON, 'DD-MON-YY HH.MI.SS')) > 2;
I assuming you are looking this data from a table, also you need to check the format, the current you're using not gonna work, i suggest the format 'DD-MON-YY HH.MI.SS'