timediff mysql to postgres

Discussion in 'MySQL' started by franrtorres77, Dec 2, 2010.

  1. franrtorres77

    franrtorres77 New Member

    Joined:
    Nov 14, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    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.

    Can anyone help me please?

    Best regards.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice