Group using column name or table attributes

  • Hello expert,

    is it possible to create a grouping object based on column name in table?

    I have for instance a table: Activities and 4 columns: Labor, Fabrication, Transport, Distribution.

    I would like to create an object which will group those columns into Manufacturing und Distribution, e.g:

    CASE WHEN Activities.ColumnName = 'Labor' THEN 'Manufacturing'

    CASE WHEN Activities.ColumnName = 'Fabrication' THEN 'Manufacturing'

    CASE WHEN Activities.ColumnName = 'Transport' THEN 'Logistik'

    CASE WHEN Activities.ColumnName = 'Distribution' THEN 'Logistik'

    END AS Activity

    How could I do it?

    Thanks

    mtraore

  • Please post DDL, DML to create sample data, expected results and what you have tried so far.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

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

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