Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Skipped Series
Message
 
 
To
18/09/2007 21:55:40
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Miscellaneous
Thread ID:
01254517
Message ID:
01255343
Views:
24
The query could be simplified if you're only interested in skipped series between min and max values in the table
SELECT t1.Orno+1 AS bg, t2.Orno-1 AS en
	FROM #mytable t1 
	FULL JOIN #mytable t2 
		ON t2.Orno > t1.Orno
	WHERE (t2.Orno - t1.Orno) > 1
		AND NOT EXISTS ( SELECT * FROM #mytable 
			WHERE Orno > t1.Orno AND Orno < t2.Orno)
>
>Thanks for the reply. I Will try what you suggested and will keep you posted.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform