Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing records from a SQL query
Message
 
 
To
21/01/2010 17:11:54
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01445297
Message ID:
01445355
Views:
18
>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform