Find Absolute of Minimum value

Last Post 25 Jun 2007 07:55 AM by SQL_Blue. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
SQL_Blue
New Member
New Member

--
25 Jun 2007 06:23 AM
Hi,

I have to find max and min value of sales of a company within the last 2 years.
Then, I need to find the absolute max and absolute min values.

So, my query is something like below:

select min(sales) as minsales, max(sales) maxsales,
abs(min(sales)) as absminsales, abs(max(sales)) as absmaxsales
from table1.


this works fine when all the number are positive, but with the negative number,
it does not look right, could you please tell me if I am doing anything wrong.

say, the max sales I found is 10, and minimum is -100.
so if I do Absolute on this, it would become absolute of max sale is 10 and absolute min value is 100.
is it right that a min value be greater than a maximum value AFTER the absolute?

thanks.
SQL_Blue
New Member
New Member

--
25 Jun 2007 07:55 AM
okay, that is what i thought in math it would tell you to ingnore the sign, but it looks weird
when I look at it as absolute max and min in sql.

Thanks very much Russellb.
You are not authorized to post a reply.

Acceptable Use Policy