I have a table containing the following:
name type
id : INT
date1 : DATETIME
date2 : DATETIME
And I need to calculate the difference between date2 and date1.
This is possible using the TIMEDIFF function in MySQL.
However, is there a way to get the result of TIMEDIFF(date2,date1) using one select, and not using 2 helper selects:
select TIMEDIFF( (select date2 from example_table where id=1) , (select date1 from example_table where id=1) );