Replace Value

  • I am trying to finish formatting a Report and 1 of the columns comes in 0 or 1.

    I want to Replace the 0 = Pre-Owned & 1 = Unworn

    SELECT

    ITEMS_PK as 'SKU 1',

    INVNUM as 'SKU 2',

    OWNERNUM as 'Online SKU',

    NEWITEM as 'Condition'

    FROM items

    Result

    SKU 1 SKU 2 Online SKU Condition

    940 I-940 CA11 1

    717 I-717 RL6 1

    247 I-247 1265 0

    325 I-325 1507 0

    846 I-846 26113 1

    260 I-260 1299 0

    Expected:

    SKU 1 SKU 2 Online SKU Condition

    940 I-940 CA11 Unworn

    717 I-717 RL6 Unworn

    247 I-247 1265 Pre-Owned

    325 I-325 1507 Pre-Owned

    846 I-846 26113 Unworn

    260 I-260 1299 Pre-Owned

    Much appreciated your help!

  • have you considered using "CASE WHEN...THEN...ELSE...END"

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • select sku1 as [SKU 1],sku2 as [SKU 2],

    onlinesku as [Online SKU],

    case condition when 1 then 'Unworn' when 0 then 'Pre-Owned' else 'No-Status' end Condition

    from items

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

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