concatenating string values conditionally in a view

  • I hope someone can help with a basic question involving a simple select statement.

    In my view, I want to conditionally concatenate the output two values in a single derived column. I know this should be simple but I can't find any reference for the basic sytax that will work in the query grid of Enterprise Manager.

    EXAMPLE:

    firstName = John

    firstName2 = Duke

    concatenatedName = John & Duke

    * However, if firstName2 has no value, then

    concatenatedName = "John" (without the "&")

    A snapshot of my query grid is located at:

    http://www.bigbridge.us/sql_issue.htm

    Any help is MUCH appreciated.

    Christopher

  • Nervmind -- I finally found it. For anyone interested, the solutions is simply:

    Select firstName

    + COALESCE (' & ' + firstName2, '')

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

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