Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Include Count Of Records In this Query
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01399490
Message ID:
01399494
Views:
51
>Ok, so now I have this query
>
>
>
>	SELECT LH.*, Derived.RecordCount 
>		FROM LocationHistory LH 
>		INNER JOIN (SELECT MAX(Sequence) AS Sequence, count(*) as RecordCount, PartID, SerialNo 
>			FROM LocationHistory  
>			GROUP BY PartID, SerialNo ) Derived 
>				ON LH.Sequence = Derived.Sequence and 
>				   LH.PartID = Derived.PartID and 
>				   LH.SerialNo = Derived.SerialNo
>
>
>I want to include as part of the result set a count of all records of each PartId/SerialNo combination

Kevin,

Please see changes inside.
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