March 4, 2013 at 3:02 am
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
March 4, 2013 at 3:21 am
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
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply