how to do this?

  • create table temp(id integer, comments varchar(20), custom_id integer);

    insert into temp values(1,'CEO comments', 98)

    insert into temp values(2,'SEO comments', 99)

    insert into temp values(3,'X comments', 100)

    insert into temp values(1,'SEO comments', 99)

    want output like

    id CEO_Comments SEO_Comments _ExtraComments

    1 Ceo comments seo comments Null

    2 null seo comments null

    3. null null x comments

    any idea?

    Thanks

  • with such minimum details...

    select id

    ,max(case when custom_id= 98 then comments else null end) As CEO_Comments

    ,max(case when custom_id= 99 then comments else null end) As SEO_Comments

    ,max(case when custom_id= 100 then comments else null end) As _ExtraComments

    from temp

    group by id

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

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

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