Comparing Computed columns

  • 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

  • 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

  • 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

    [font="Courier New"]
    ------------------------
    MCPD Web Developer, MCPD Windows Developer
    [/font]

    Computers are made to solve problems you did not have in the days they didn't exist.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply