SSRS sorting or SQL order by a column by another column value

szadroga
szadroga used Ask the Experts™
on
i am looking to filter data on 2 columns but one column sort would be based on another columns value.

For example, i want to filter by Severity ASC, then by lastname but want these results not alphabetical but by the values of hours worked in another column.  So the first lastname to appear would be the one that has worked the most hours.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Brian CroweDatabase Administrator
Top Expert 2005

Commented:
Why can't you just sort by the "hours worked"?  Why does lastname come into it at all?

Author

Commented:
looking for a "grouping" for lastname.  this way all the lastnames are together so you can see quickly how many tasks a person has charged time to.
Database Administrator
Top Expert 2005
Commented:
So it sounds like you want to order by an aggregate value while your are displaying at the detail level.  You would need to provide aggregate data at the detail level to make this happen.

You can do this in your query by joining against aggregate data but since I don't know anything about your schema or report I can't give you much in the way of direction.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial