http://metaclass.livejournal.com/ ([identity profile] metaclass.livejournal.com) wrote in [personal profile] metaclass 2013-04-29 11:15 am (UTC)

Можно. Что-то вроде
select * from
(select month,1 k, item, sum(amount) from Items
group by 1,2,3
union
select month,2 k, '', sum(amount) from items
group by 1,2,3
) order by month,k

ну или помудрить с CTE, чтобы два раза не вставать к основной таблице.

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting