Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Comparing Computed columns Expand / Collapse
Author
Message
Posted Wednesday, September 17, 2008 5:07 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, August 15, 2012 9:16 AM
Points: 6, Visits: 153
Hello,
I have got 2computed columns.

select * from table followed by condition as memotype1
I want to pick up my memovalue1 based on memotype1

When i did select * from where memotype=memotype1 ,it is not picking the value.

how can i compare a computed column to populate another computed column
Post #570902
Posted Wednesday, September 17, 2008 7:02 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Thursday, December 18, 2014 9:58 AM
Points: 13,872, Visits: 9,600
I'm not sure I follow your question. Are you asking how to select a computed column, or how to create one? You can't use one computed column in the definition of another computed column, if that's what you're asking about. But you can include the definition of the first one in the definition of the second one.

- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #570963
Posted Thursday, September 18, 2008 4:36 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Tuesday, March 8, 2011 2:31 AM
Points: 513, Visits: 38
If I get the point right, you want to use a computed column in the select query. In that case, you should use something like (sorry for possible syntax errors, I have no SQL available where I currently reside :) ):

select * from
(
select SomeColumWithComputation as ComputedColumn
from SomeTable
) tmp
where ComputedColumn=bla

Cheers! Bert



------------------------
MCPD Web Developer, MCPD Windows Developer


Computers are made to solve problems you did not have in the days they didn't exist.
Post #571614
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse