Amazon offers their marketplace customers a CSV report which contains information about every article you sold. There are four rows per article, looking like this:
you can calculate itemprice and itemfees with two queries and join them
select a.orderid, a.price, b.fees
from (select orderid, sum(amount) price from report where amounttype='ItemPrice' group by orderid) a
join (select orderid, sum(amount) fees from report where amounttype='ItemFees' group by orderid) b
on a.orderid = b.orderid
this asumes there is at least one row with itemprice and one row with itemfees. otherwise you should use an outer join.