Microsoft
Software
Hardware
Network
Question : SQL 2008 - Need to use calcualted field in another calculation
I need to use a calculated field in a query in another area of the same query. I have
SUM(tbl_nav_now - nav_past) AS Change, and I tried the following
Sum(Change / tbl_nav_now) AS Percent but it did not like it. What would be the correct syntax with rounding?
Any help is appreciated.
Answer : SQL 2008 - Need to use calcualted field in another calculation
are you ignoring my post?
Sum(Change / tbl_nav_now) AS Percent
-->
Sum((tbl_nav_now - nav_past) / tbl_nav_now) AS Percent
if you exactly want x.xx format you should use cast
Cast(Sum((tbl_nav_now - nav_past) / tbl_nav_now), decimal(10,2)) AS Percent
Random Solutions
Not recognizing next years dates in Dataset Search
How to identify the correct globalization for date types ?
Redirect to page based on credentials
Windows 2000 Server - Administrator ID - Invalid security ID Structure
Using a date varible in where clause of SQL
Exchange 2007 booking a conference room
IntoPath-How to populate a non-repeating field with a repeating field value on a condition
I need help with an ODBC Connection with Access 2007
Tivoli Storage Manager Backup Archive Client App Crash DSM.EXE after installing on Windows Server 2008 R2 64 bit
Exchange 2010 ports - What firewall ports need to be open