Case when query on same amount column

I have one table which has amount column and Type_of_Order column, if sales if order then positive value and Type_of_Order ='SALES O' and if I will make return of any product from shop then amount will be negative and Type_of_Order ='RETURN O',
Using Sql server 2012
Now I need this by query sr name, if Type_of_Order column has 'SALES O' then Order_P column should created , if case when if Type_of_Order column has ''RETURN O' then Order_R column should created and value should come in single line .

SR NAME Order_P Order_R
XYZ 9875 -123

Please provide sample data in the form of create table with inserts.

1 Like

select
case Type_of_Order when 'SALES O' then Order_P
when 'RETURN O' then Order_R end
from table

hope this helps :slight_smile: :slight_smile: