• Hello,

    my first thought is create a temp table or var table including these relations, then join.

    CREATE TABLE #T (ProdGrpCode varchar(10), ResultCode VARCHAR(10))

    INSERT INTO #T

    SELECT '500', '82' UNION SELECT '510', '82' UNION SELECT '5201', '82' UNION

    SELECT '580', '82' UNION SELECT '630', '82' UNION SELECT '460', '82' UNION

    SELECT '470', '82' UNION SELECT '480', '82' UNION SELECT '490', '82'

    Now, your reference

    case

    when ProdGrpCode in ('500','510','5201','580','630','460','470','480','490') then '82'

    ....

    is replaced simply by ResultCode.

    Francesc