MySQL Forums
Forum List  »  Newbie

Re: How do you get both the value from the CURRENT row and the value from an ADJACENT row?
Posted by: Montana Burr
Date: December 30, 2021 02:30PM

Whoops, this is how to do a self-join:


SELECT t1.ID, t1.eventID, t1.eventDate, t2.eventDate
FROM table t1
JOIN table t2
ON t1.ID = t2.ID AND t2.eventID = t1.eventID + 1

Options: ReplyQuote


Subject
Written By
Posted
Re: How do you get both the value from the CURRENT row and the value from an ADJACENT row?
December 30, 2021 02:30PM


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.