mysql query to postgres Timediff

Поиск
Список
Период
Сортировка
От franrtorres77
Тема mysql query to postgres Timediff
Дата
Msg-id 1291283328744-3289115.post@n5.nabble.com
обсуждение исходный текст
Ответы Re: mysql query to postgres Timediff  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-general
Hello

I have the next query in mysql to get the time difference from two rows, but
I would like to implement it in postgres, but I'm getting some errors when I
try to query it.

select speed,mobile,date,
timediff(@nexttime,date) as tdiff2, (@nexttime:=date) as Next
from positions
where speed=0 and mobile = 1883 and date >(now() - interval 2 hour)

I have changed the last part to: (now() - interval '2 hours') but I go on
getting another error in the Timediff command.

What I want to do is something like this:

14-12-2010 20:25:40
14-12-2010 20:26:45

So, the result would be: the substract of both dates to get how much time
have spent from the last date
,  so it will result 00:01:05 minutes

Can anyone help me please?

Best regards.
--
View this message in context:
http://postgresql.1045698.n5.nabble.com/mysql-query-to-postgres-Timediff-tp3289115p3289115.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

В списке pgsql-general по дате отправления:

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: How to recover a postgres installation from files
Следующее
От: Dmitriy Igrishin
Дата:
Сообщение: Re: number of rows returned by a query