mysql - how to insert difference between two hours in sql statement? -


it frustrating mysql doesnot support procedure language..

problem have 2 time variables in mysql tables time1 , time 2, have time variable column difftime. difftime stores time interval between time 1 , time 2. need insert statement : insert table(time1, time2, difftime) value(time1, time2, diffbetween(time1 , time2))

is there way solve problem, additionally how use procedure language in phpmyadmin....

many thanks

it depends on type of time1 , time2 , kind of difference need get, can use timediff() or datediff()

insert `table` (time1, time2, difftime)  select time1, time2, timediff(time2, time1)   othertable 

sqlfiddle


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -