MySQL Forums
Forum List  »  Newbie

Re: LAG/LEAD function
Posted by: Peter Brawley
Date: November 27, 2018 11:54AM

Two syntax errors in the query you posted ...

SELECT 
  id,device_id, time,                     -- comma was missing after time
  LAG(time) OVER(W) AS 'lag', 
  time - LAG(time) OVER(W) as 'lag diff'  -- OVER(W) was missing after LAG(time)
FROM watchdog 
WINDOW W AS (ORDER BY time) ;

Options: ReplyQuote


Subject
Written By
Posted
November 27, 2018 02:51AM
Re: LAG/LEAD function
November 27, 2018 11:54AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.