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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 view reference in calculation

Author  Topic 

magicman
Starting Member

6 Posts

Posted - 2008-01-14 : 04:11:15
Hi,

I am trying to do a calculation in a newly created VIEW Called vwSpeeds , I have done a calculation i.e Speed A +ISNULL(SpeedB,0) AS TOTAL from tblspeeds. So TOTAL is a new column in the view.
However if I want to apply another calculation to this column how can I reference the TOTAL column, as I get error saying can't find field.
I was using (dbo.tblAdjustment * vwspeeds.TOTAL) AS NewTotal (in vwspeeds)

Am I missing something here?
Thanks Harry.

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2008-01-14 : 04:19:23
quote:
Originally posted by magicman

Hi,

I am trying to do a calculation in a newly created VIEW Called vwSpeeds , I have done a calculation i.e Speed A +ISNULL(SpeedB,0) AS TOTAL from tblspeeds. So TOTAL is a new column in the view.
However if I want to apply another calculation to this column how can I reference the TOTAL column, as I get error saying can't find field.
I was using (dbo.tblAdjustment * vwspeeds.TOTAL) AS NewTotal (in vwspeeds)

Am I missing something here?
Thanks Harry.



It caused error as the view does not have the new column, TOTAL. Can you please mention the view here.

thanks,

Mahesh
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-01-14 : 04:21:08
You can't reference it. All columns in the view must be from the base table(s).


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -