Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Removing records from a SQL query
Message
 
 
À
21/01/2010 17:11:54
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:
01445297
Message ID:
01445355
Vues:
19
>>If you want the fastest result, then try packed value solution from that blog.
>
>Thanks
select PK, cast(substring(MaxValue,11,10) as int) as ChildPK, MaxChildField 
from (select PK, Max(ChildField) as MaxChildField, 
max(cast(ChildField as char(10)) + cast(ChildPKField as char(10))) as MaxValue from myTables GROUP BY PK) X
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