Go4Expert (http://www.go4expert.com/)
-   MySQL (http://www.go4expert.com/forums/mysql-forum/)
-   -   timediff mysql to postgres (http://www.go4expert.com/forums/timediff-mysql-postgres-t24060/)

franrtorres77 2Dec2010 15:05

timediff mysql to postgres

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.

Can anyone help me please?

Best regards.

All times are GMT +5.5. The time now is 07:11.