quote: Originally posted by visakh16 thats obvious. Unless you group on that field you cant use it directly in order by, as grouping causes rows to be aggregated andmight involve multiple value of closedCallWty within same group so order by on that doesnt make senseperhaps you can explain what you're trying to do with some sample data------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
Here is a small sampling of the raw data (the query actually pulls from a view which pulls in some labels for abbreviations as well as does a permissions check based on permissions that are defined in another table):5000,APL,APLGROSV,4/1/2011,0,0,0,0,0,0,0,0,0,0,06000,BJI,CADMIN,4/1/2011,0,0,0,0,0,0,0,0,0,0,05000,APL,APLGROSV,4/2/2011,0,0,0,0,0,0,0,0,0,0,06000,BJI,CADMIN,4/2/2011,0,0,0,0,0,0,0,0,0,0,05000,APL,APLGROSV,4/3/2011,0,0,0,0,0,0,0,0,0,0,06000,BJI,CADMIN,4/3/2011,0,0,0,0,0,0,0,0,0,0,0 I would like a single row returned for 5000 and a single row returned for 6000 (among the several hundred other options) that combine all of the totals if the date is between the beginning and ending specified. That piece of it is working as desired.What I also would like to be able to do is then sort the data for each of the columns. Currently, I can only sort based on the location (which I understand since that is all that is included in the group by). The thought of sorting by the other columns is easy to wrap my mind around - the technical implementation of it isn't so much. |