Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need Having clause
Message
De
26/07/2010 23:16:54
 
 
À
26/07/2010 23:06:16
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:
01474073
Vues:
47
I have the following but I thought there would be a way to make it simpler:
DECLARE @NoSite Integer
DECLARE @NoAlbum Integer

SET @NoSite=2
SET @NoAlbum=0

SELECT TOP 3 Temp.Title,Temp.Url,Temp.NoProvince,Temp.Code,Temp.City,Temp.Date,Temp.NoCompany,
 Temp.Company,Temp.Url,Temp.NoAlbum,Temp.AlbumUrl
 FROM
 (SELECT Event.Title,Event.Url,Event.NoProvince,Province.Code,Event.City,Event.Date,Event.NoCompany,
 Company.Title AS Company,Event.NoAlbum,Album.Url AS AlbumUrl,
 (SELECT COUNT(*) FROM Photo WHERE Album.Numero=Photo.NoAlbum) AS 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
 WHERE Event.NoSite=@NoSite AND Event.NoAlbum>@NoAlbum) Temp
 WHERE Temp.PhotoCount>=7
 ORDER BY Date DESC 
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform