Ordering sql query results

Posted by user343409 on Stack Overflow See other posts from Stack Overflow or by user343409
Published on 2010-05-17T20:15:16Z Indexed on 2010/05/17 20:20 UTC
Read the original article Hit count: 204

Filed under:
|
|

My sql query gives the columns:

  • product_id (which is an integer)
  • pnl (which is float - can be negative)

I get more than 100 rows.

I want to filter out the top 40 rows based on abs(pnl). But the results should be ordered by pnl column only and not by abs(pnl).

I want to do this for MSSQL 2005.

Is there a way to do this?

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server