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
The transaction log for database 'mydatabase' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases
Complex SQL Statement Help
What is the MS Access 2007 version of this code?
Custom Ribbon vba tab selection
How to tell if Windows server 2008 is in Native mode
MS Access 2007 - closing a table
Weird color change when switching from MS Excel to MS Access
offline synchronized file Gone how to restore them?
Mutliple Zones when adding a webpart to a page
Access 2000 - Query Crteria Problem