MySQL Forums
Forum List  »  Newbie

Re: how to compare the current record to the next in the same table in terms of 'datetime'?
Posted by: Peter Brawley
Date: June 14, 2014 03:29PM

Exclusion joins are costly. Even after you optimise indexing according to what Explain tells you, the query will likely be slow.

SQL is set-based. Row-to-row computation like that is usually done most efficiently in your application language. If you're bound and determined to do it in SQL, consider a user var approach; lots of examples under "Sequences" at www.artfulsoftware.com/queries.php.

Options: ReplyQuote




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.