Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Skipped Series
Message
 
 
À
18/09/2007 21:55:40
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
01254517
Message ID:
01255343
Vues:
31
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--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform