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
Speed Issues when converting Access 97 to Access 2003
Sum values based on multiple input criteria (month and product type)
Save unbound combobox column value in Access 2007
Office Communications Server 2007 info
Dynamics GP Web Services PHP
How do I encrypt a string so that it is suitable to be a filename?
sql query
Insert File VBA issues with Styles
Ghost with Windows 7
Help! I'm getting an OleDbException: No error message available, result code: E_FAIL(0x80004005), trying to open an oleDBConnection to an Excel file.