Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculate field with the same conditions
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:
01502373
Message ID:
01502398
Vues:
26
>>>>Try using derived table - it will be most likely a better performance:
>>>>
>>>>select M.FirstName, M.LastName, O.AddDate, O.CountRecord from Member M
>>>>inner join (select max(AddDate) as AddDate, count(*) as CountRecord, NoMember 
>>>>from [Order] group by NoMember) O
>>>>on M.Numero = O.NoMember
>>>
>>>Do you see a difference with Hugo's approach in regards to performance?
>>
>>Both suggestions are exactly the same (but I was quicker :))
>>If you need to get records with no orders, change INNER JOIN to LEFT JOIN.
>
>Yes, I should have skipped the formatting :P

LOL :)
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform