Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need Having clause
Message
 
 
À
26/07/2010 23:20:08
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:
01474077
Vues:
36
>>Try
>>
>>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
>>CROSS APPLY (SELECT COUNT(*) FROM Photo WHERE Album.Numero=Photo.NoAlbum) F
>> WHERE Event.NoSite=@NoSite AND Event.NoAlbum>@NoAlbum
>>  AND F.PhotoCount >=7
>> ORDER BY Event.Date DESC 
>>
>
>Thanks, I will keep the other approach. It makes it simpler to understand. But, it is good to know this can be accomplished using that approach as well.

What is hard to understand in the case I suggested? Besides, it should be better for performance.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform