Hi,
exact query depends on answers on these two questions:
What shall be the result when there is no row with TYPE='X' for given ID?
What shall be the result when there are multiple rows with TYPE='X' for given ID?
Anyway, if there are no duplicates with TYPE='X' or you do not mind mixing values from those rows, you may use CASE/DECODE expression in any aggregate function accepting strings, e.g.
Code:
select id,
max( case when type = 'X' then name end ) name,
<similar expression for type or any other column>,
sum(sal) sal
from <table name you did not reveal>
group by id;