Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need Having clause
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01474071
Message ID:
01474086
Vues:
41
What about:
SELECT TOP 3
		Event.Title, 
		Event.Url,
		Event.NoProvince,
		Province.Code,
		Event.City,
		Event.Date,
		Event.NoCompany,
		Company.Title AS Company,
		Event.Url,
		Event.NoAlbum,
		Album.Url AS AlbumUrl,
		F.PhotoCount
	FROM	Event (NOLOCK)
	LEFT	JOIN Province ON Event.NoProvince = Province.Numero
	LEFT	JOIN Company ON Event.NoCompany = Company.Numero
	INNER	JOIN Album ON Event.NoAlbum = Album.Numero
	INNER	JOIN 
			(
				SELECT		
					Photo.NoAlbum, 
					COUNT(*) as PhotoCount
				FROM	Photo
				GROUP	BY Photo.NoAlbum
			) F ON F.NoAlbum = Album.Numero
	WHERE	Event.NoSite = @NoSite AND Event.NoAlbum > @NoAlbum
		AND F.PhotoCount >= 7
	ORDER	BY Event.Date DESC 
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform