So I am new to SQL and have been actively learning it whilst we have some time on our hands to improve our reporting.
I need to take data and present it as per a pivoted table the standard pivot function presents the data like this;
So I found the support on pivots and have simplified my model so I can get an understanding (its about 1/3 of the way down);
So I have taken this and adapted it to my needs in a very simple form so I don't get too lost in it, before I fully understand it, so I have created this:
SELECT
"pivot"."Targets/Invoice/Backlog Owner" as "Targets/Invoice/Backlog Owner",
"pivot"."February Target" as "February Target"
FROM (SELECT
"Targets/Invoice/Backlog"."Targets/Invoice/Backlog Owner" as "Targets/Invoice/Backlog Owner",
"Targets/Invoice/Backlog"."February Target"
FROM "Targets/Invoice/Backlog")
AS "pivot-source"
pivot
(sum("pivot-source"."Targets/Invoice/Backlog Owner") FOR "pivot-source"."February Target" in ( "Targets/Invoice/Backlog Owner", "February Target" )
) AS pivottable
Right now the error seems to revolve around line 9, Pivot (I highlighted in red).... or is it the Pivots in the 2nd and 3rd lines causing me issues?
Unknown table or alias 'pivot' used in select query.
am I being dumb, pointers would be nice if you have the time.
Stay safe
Iain