Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««123

T-SQL - SELECT TOP Expand / Collapse
Author
Message
Posted Thursday, March 19, 2009 11:13 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 6:59 AM
Points: 22,492, Visits: 30,186
Yes, there are issues with the query itself, but what did the question ask? How do you ensure you get the top 25 in sales. The only answer that works there is that you also need to add an ORDER BY SUM(salesdollars) DESC.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #679688
« Prev Topic | Next Topic »

Add to briefcase «««123

Permissions Expand / Collapse