You are here: Re: Date overlapping « MsSQL Server « IT news, forums, messages
Re: Date overlapping

Posted by markc600 on 10/09/06 12:22

Try this

SELECT s1.Start,
MIN(t1.Stop) AS Stop
FROM Intervals s1
INNER JOIN Intervals t1 ON s1.Start <= t1.Stop
AND NOT EXISTS(SELECT * FROM Intervals t2
WHERE t1.Stop BETWEEN t2.Start AND t2.Stop
AND t2.Stop > t1.Stop)
WHERE NOT EXISTS(SELECT * FROM Intervals s2
WHERE s1.Start BETWEEN s2.Start AND s2.Stop
AND s2.Start < s1.Start)
GROUP BY s1.Start

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация