Спасибо за ваши ответы. На самом деле, я нашел что-то в plsql, который прекрасно работает:
select clientname,
max(decode(trim(dow),'MONDAY',totalquantity,0)) Mon,
max(decode(trim(dow),'TUESDAY',totalquantity,0)) Tue,
max(decode(trim(dow),'WEDNESDAY',totalquantity,0)) Wed,
max(decode(trim(dow),'THURSDAY',totalquantity,0)) Thu,
max(decode(trim(dow),'FRIDAY',totalquantity,0)) Fri,
(
max(decode(trim(dow),'MONDAY',totalquantity,0)) +
max(decode(trim(dow),'TUESDAY',totalquantity,0)) +
max(decode(trim(dow),'WEDNESDAY',totalquantity,0)) +
max(decode(trim(dow),'THURSDAY',totalquantity,0)) +
max(decode(trim(dow),'FRIDAY',totalquantity,0))
) TOTAL
from
(
select clientname,
to_char(tradedate, 'DAY') as dow,
sum(quantity) as totalquantity
from ClientTrade a
where a.tradedate >= trunc(sysdate-7,'D')
and a.tradedate <= trunc(sysdate-7,'D') + 4
group by c.clientshortname, tradedate
)
group by clientname