No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
2 Posted Topics
The Top 5 expression returns 5 rows of data based on your where clause criteria. You have to add the min() aggregate function in the this case in order to limit the records based on school that fit the where clause criteria. For example see the Table Sample, Query Sample …
--Query that selects the distinct rows using a subquery and then does the aggregation [CODE]Select Count(ThreadId), Sum(Viewed) as View_Summary From (Select Distinct ThreadId, Viewed From #tableViews) a[/CODE] --OR-- --Query that eliminates the duplicate rows using the union clause and then does the aggregation [CODE]Select Distinct Count(ThreadId), Sum(Viewed) as View_Summary From …
The End.
Perez_Bottoms