Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
convert(decimal(15,1),(sum(isnull(pe.org_own_assets_ext,0)))+(sum(isnull(pe2.org_own_assets_ext,0)))) as total_assetsI think the problem is with the + sign, maybe?
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts
Posted - 2008-02-01 : 12:09:58
What error is reported by SQL Server?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
TG
Master Smack Fu Yak Hacker
6065 Posts
Posted - 2008-02-01 : 12:13:13
What is the problem? There doesn't seem to generate any errors.
selectconvert(decimal(15,1),(sum(isnull(pe.org_own_assets_ext,0))) +(sum(isnull(pe2.org_own_assets_ext,0)))) as total_assetsfrom (select 1 as org_own_assets_ext) pejoin (select 1 as org_own_assets_ext) pe2 on 1=1output:total_assets ----------------- 2.0
Be One with the OptimizerTG
crugerenator
Posting Yak Master
126 Posts
Posted - 2008-02-01 : 12:14:41
There actually is no error...It's just not doing the math right. Here's an example:The value in pe.org_own_assets_ext = 36189.5The value in pe2.org_own_assets_ext = 277.10I am getting 303764.6I should be getting 36466.6
TG
Master Smack Fu Yak Hacker
6065 Posts
Posted - 2008-02-01 : 12:20:31
You must have an error in your JOIN criteria, looks like some rows are getting "crossed up"Be One with the OptimizerTG