bibi92
asked on
create an aggregate function
Hello,
How can I create an aggregate function that receives a float as an input and outputs its absolute value?
Thanks
regards
How can I create an aggregate function that receives a float as an input and outputs its absolute value?
Thanks
regards
Why you're looking for create this function, you have one called ABS: https://msdn.microsoft.com/en-us/library/ms189800.aspx
ASKER
Hello
Ok but how create this function?
Thanks
regards
Ok but how create this function?
Thanks
regards
you don't, it is created just use it
ASKER
I know I can use it, a user asks me to create a function to use it. Thanks
have a look at https://msdn.microsoft.com/en-us/library/ms191320.aspx
That the user asked for it does not mean that giving it to him/her is the right thing to do :)
One example, taking the sum of the absolute values:
OTOH, if you wanted the absolute value of the sum:
One example, taking the sum of the absolute values:
SELECT Location, SUM(ABS(Sales)) AS AbsSales
FROM SomeTable
GROUP BY Location
OTOH, if you wanted the absolute value of the sum:
SELECT Location, ABS(SUM(Sales)) AS AbsSales
FROM SomeTable
GROUP BY Location
have a look here this may help you: https://msdn.microsoft.com/en-us/library/91e6taax(v=vs.100).aspx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks regards