with T as ( select 1 id, 1 pay_type, cast('01.01.2019' as...

0

Please login or register to vote for this query.

(click on this box to dismiss)

SharePoint

Q&A for SharePoint enthusiasts

with T as
(
select 1 id, 1 pay_type, cast('01.01.2019' as date) pay_date, 100 pay_sum from posts
where id = 28970
union all
select 2 id, 1 pay_type, cast('02.01.2019' as date) pay_date, 200 pay_sum from posts
where id = 28970
union all
select 3 id, 1 pay_type, cast('10.01.2019' as date) pay_date, 300 pay_sum from posts
where id = 28970
union all
select 4 id, 1 pay_type, cast('01.02.2019' as date) pay_date, 400 pay_sum from posts
where id = 28970
union all
select 5 id, 1 pay_type, cast('03.02.2019' as date) pay_date, 500 pay_sum from posts
where id = 28970
union all
select 6 id, 2 pay_type, cast('01.01.2019' as date) pay_date, 600 pay_sum from posts
where id = 28970
union all
select 7 id, 2 pay_type, cast('01.02.2019' as date) pay_date, 700 pay_sum from posts
where id = 28970
union all
select 8 id, 2 pay_type, cast('03.02.2019' as date) pay_date, 800 pay_sum from posts
where id = 28970
union all
select 9 id, 2 pay_type, cast('01.03.2019' as date) pay_date, 900 pay_sum from posts
where id = 28970
union all
select 10 id, 2 pay_type, cast('05.03.2019' as date) pay_date, 1000 pay_sum from posts
where id = 28970
union all
select 11 id, 3 pay_type, cast('10.01.2019' as date) pay_date, 1100 pay_sum from posts
where id = 28970
union all
select 12 id, 3 pay_type, cast('01.02.2019' as date) pay_date, 1200 pay_sum from posts
where id = 28970
union all
select 13 id, 3 pay_type, cast('06.02.2019' as date) pay_date, 1300 pay_sum from posts
where id = 28970
union all
select 14 id, 3 pay_type, cast('05.03.2019' as date) pay_date, 1400 pay_sum from posts
where id = 28970
union all
select 15 id, 3 pay_type, cast('07.03.2019' as date) pay_date, 1500 pay_sum from posts
where id = 28970
)

select  pay_type--, extract(month from pay_date) || '.' || extract(year from pay_date) as dt ,  sum(pay_sum)
from T
--where pay_type = 1
group by pay_type--, dt

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results