Master Dev Master Dev - 1 year ago 81
MySQL Question

MYSQL get diffrence between two dattimes in minutes and update in field

  • I have table with 3 fileds id, startdate,enddate now i have added new field called mins as mentioned in image.

  • I need query to get diffrence between startdate and enddate in minutes and store in fields mysql...table image

Answer Source


UPDATE YourTable t 
set t.mins =  TIMESTAMPDIFF(MINUTE,t.startdate,t.enddate) ;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download