MySQL Forums
Forum List  »  Newbie

Re: Can datediff be used?
Posted by: Anthony Willard
Date: December 11, 2006 01:16PM

Editorial aside, I don't know if DATEDIFF is a good answer as it returns a number, not true or false.

If you were to look at every date and look for the "next" date in sequence, you could join on that. It's not DATEDIFF, but DATE_ADD().

SELECT a.*
FROM mytable a
LEFT OUTER JOIN mytable b ON b.mydate = DATE_ADD( a.mydate, INTERVAL 1 DAY )
WHERE b.mydate IS NULL

This might still respect indexes and perform well.

Give that a try.

Anthony

Options: ReplyQuote


Subject
Written By
Posted
December 08, 2006 03:18PM
December 08, 2006 03:24PM
December 09, 2006 06:42AM
December 11, 2006 11:53AM
Re: Can datediff be used?
December 11, 2006 01:16PM


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.