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.