CREATING NEW CONDITIONAL COLUMN IN VIEW

  • I have a view that contains order shipping info (order#, name, address1, EmailAddress, etc.) using existing table fields. It works great in conjunction with our UPS shipping app but now I need another column in the view called "Profile". The value in Profile will be dependent upon whether existing "EmailAddress" column is null or not. If I were doing this in Access QBE grid it would read

    Profile:IIf([EmailAddress] is not null, "QV", "PARK")

    I know I should be using CASE_WHEN_ELSE but not sure where to use AS to give the column the name "Profile". Any help would be appreciated!

  • ...

    select field1,

    case when [EmailAddress] is not null then 'QV' else 'PARK' end as Profile,

    field2

    from

    ...

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Thanks Matt! Did the trick.

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

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