var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Substract datetime rows with where clause
I have a table where are stored some values such as:
Id, Mobile, Speed, DateTime
175080, 1886, 40, 2012-10-03 08:07:56
175081, 2470, 75, 2012-10-03 08:08:48
175082, 1886, 0, 2012-10-03 08:10:59
175083, 1886, 20, 2012-10-03 08:12:59
And I used to use a query for substracting these dates and then get the difference between two dates:
SELECT f.id, f.mobile, f.DateTime as StardDate, f2.DateTime as EndDate,
(f.DateTime -f2.DateTime) AS difference
FROM table f, table f2
where f2.id = f.id-1
order by f.DateTime desc
The problem is that previously I only have one mobile and now I have more.
How can I just substract the dates of the mobile 1886 ?
this idea of joining on id = id - 1 is flawed
so, how can I do the substract then?
Tags for this Thread