|
Posted by M A Srinivas on 06/05/07 12:23
On Jun 5, 4:02 pm, Mirnes <leme...@yahoo.com> wrote:
> I have table with following structure:
>
> Cust Amount Type
> 1 150.00 1
> 1 100.00 2
>
> I would like to get query result:
>
> Cust Type1 Type2
> 1 150.00 0.00
> 1 0.00 100.00
>
> How to do this with query?
create table #customer( cust int,amount numeric(10,2), type int)
insert into #customer values (1,150.00,1)
insert into #customer values (1,100.00,2)
select cust,
case when type = 1 then amount else 0.00 end as type1 ,
case when type = 2 then amount else 0.00 end as type2
from #customer
drop table #customer
Navigation:
[Reply to this message]
|