I have following data :
a.tb_name a.start_time a.end_time a.createdon total_time_min a.modifiedon a.byuser
_2a 2018-02-15 13:17:04.795 2/15/2018 smt
_2a 2018-02-15 13:19:11.11 2/15/2018 smt
start & endtime are in strings ( I can use any datatype) . The output I need is total time in minutes:
a.tb_name a.start_time a.end_time a.createdon total_time_min a.modifiedon a.byuser
_2a 2018-02-15 13:17:04.795 2/15/2018 smt
_2a 2018-02-15 13:19:11.11 2/15/2018 smt
_2a 2018-02-15 13:17:04.795 2018-02-15 13:19:11.11 2/15/2018 2 smt
I tried this but as both the time data is in two diffrent columns I am unable to get the result.
select minute(cast(end_time as TIMESTAMP) - cast(start_time as TIMESTAMP)) from a where tb_name like "_2a";